Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
login: go to posts only if user exist in db
  • Loading branch information
3v0k4 committed Jul 20, 2019
1 parent 1ec890d commit b90b5cc
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Handler/Landing.hs
Expand Up @@ -29,8 +29,15 @@ postLandingR :: Handler Html
postLandingR = do
((result, widget), enctype) <- runFormPost loginForm
case result of
FormSuccess _ ->
redirect PostsR
FormSuccess login -> do
user <- runDB $ selectList [ UserIdent ==. username login, UserPassword ==. Just (password login) ] []
case user of
[] ->
emptyLayout $ do
$(widgetFile "landing")

_ ->
redirect PostsR
_ ->
emptyLayout $ do
$(widgetFile "landing")

0 comments on commit b90b5cc

Please sign in to comment.