From e2d9dac13423015c84c9136b0bdb4755488a7e04 Mon Sep 17 00:00:00 2001 From: nek0 Date: Wed, 13 Aug 2014 18:16:31 +0200 Subject: [PATCH] fixed database access --- Handler/Activate.hs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Handler/Activate.hs b/Handler/Activate.hs index b347973..9672ab8 100644 --- a/Handler/Activate.hs +++ b/Handler/Activate.hs @@ -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|
Invalid Token!|]
       redirect $ HomeR
-    [x] -> do
+    Just x -> do
       _ <- runDB $ insert $ tokenUser (entityVal x)
       setMessage $ [shamlet|
User activated|]
       redirect $ HomeR
-    _ -> do
-      error "unexpected error"