fixed database access
This commit is contained in:
parent
97f72aca36
commit
e2d9dac134
1 changed files with 3 additions and 5 deletions
|
@ -4,14 +4,12 @@ import Import as I
|
|||
|
||||
getActivateR :: Text -> Handler Html
|
||||
getActivateR token = do
|
||||
t <- runDB $ selectList [TokenToken ==. token] []
|
||||
t <- runDB $ selectFirst [TokenToken ==. token] []
|
||||
case t of
|
||||
[] -> do
|
||||
Nothing -> do
|
||||
setMessage $ [shamlet|<pre>Invalid Token!|]
|
||||
redirect $ HomeR
|
||||
[x] -> do
|
||||
Just x -> do
|
||||
_ <- runDB $ insert $ tokenUser (entityVal x)
|
||||
setMessage $ [shamlet|<pre>User activated|]
|
||||
redirect $ HomeR
|
||||
_ -> do
|
||||
error "unexpected error"
|
||||
|
|
Loading…
Reference in a new issue