diff --git a/Handler/Reactivate.hs b/Handler/Reactivate.hs index 09738cd..0eaab58 100644 --- a/Handler/Reactivate.hs +++ b/Handler/Reactivate.hs @@ -16,13 +16,11 @@ postReactivateR = do ((result, reactivateWidget), enctype) <- runFormPost reactivateForm case result of FormSuccess temp -> do - tempUsers <- runDB $ selectList [UserEmail ==. temp] [] - case tempUsers of - users -> do + users <- runDB $ selectList [UserEmail ==. temp] [] + case null users of + True -> do userTokens <- foldM (\userTokens (Entity userId user) -> do token <- liftIO $ generateString --- aId <- runDB $ insert $ Activator token user --- runDB $ delete userId tId <- runDB $ insert $ Token (encodeUtf8 token) "activate" (Just userId) return $ (user, token) : userTokens ) [] users @@ -34,7 +32,7 @@ postReactivateR = do activateLink <- ($ ActivateR token) <$> getUrlRender sendMail (userEmail user) "Reset your password" $ [shamlet| -