beautyfied
This commit is contained in:
parent
db49e2d4de
commit
fd57460df1
1 changed files with 7 additions and 1 deletions
|
@ -25,7 +25,7 @@ postLoginR = do
|
||||||
Just user -> do
|
Just user -> do
|
||||||
case credentialsPasswd cred == userPassword (entityVal user) of
|
case credentialsPasswd cred == userPassword (entityVal user) of
|
||||||
True -> do
|
True -> do
|
||||||
setSession "userId" $ pack $ show $ entityKey user
|
setSession "userId" $ extractKey $ entityKey user
|
||||||
setMessage $ [shamlet|<pre>Successfully logged in|]
|
setMessage $ [shamlet|<pre>Successfully logged in|]
|
||||||
redirect $ HomeR
|
redirect $ HomeR
|
||||||
False -> do
|
False -> do
|
||||||
|
@ -35,6 +35,12 @@ postLoginR = do
|
||||||
setMessage $ [shamlet|<pre>User does not exist|]
|
setMessage $ [shamlet|<pre>User does not exist|]
|
||||||
redirect $ LoginR
|
redirect $ LoginR
|
||||||
|
|
||||||
|
extractKey :: KeyBackend backend entity -> Text
|
||||||
|
extractKey = extractKey' . unKey
|
||||||
|
where
|
||||||
|
extractKey' (PersistInt64 k) = pack $ show k
|
||||||
|
extractKey' _ = ""
|
||||||
|
|
||||||
loginForm :: Form Credentials
|
loginForm :: Form Credentials
|
||||||
loginForm = renderDivs $ Credentials
|
loginForm = renderDivs $ Credentials
|
||||||
<$> areq textField "Username" Nothing
|
<$> areq textField "Username" Nothing
|
||||||
|
|
Loading…
Reference in a new issue