fixed database access

This commit is contained in:
nek0 2014-08-13 18:16:31 +02:00
parent 97f72aca36
commit e2d9dac134

View file

@ -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"