beautyfied

This commit is contained in:
nek0 2014-08-14 00:51:40 +02:00
parent db49e2d4de
commit fd57460df1

View file

@ -25,7 +25,7 @@ postLoginR = do
Just user -> do
case credentialsPasswd cred == userPassword (entityVal user) of
True -> do
setSession "userId" $ pack $ show $ entityKey user
setSession "userId" $ extractKey $ entityKey user
setMessage $ [shamlet|<pre>Successfully logged in|]
redirect $ HomeR
False -> do
@ -35,6 +35,12 @@ postLoginR = do
setMessage $ [shamlet|<pre>User does not exist|]
redirect $ LoginR
extractKey :: KeyBackend backend entity -> Text
extractKey = extractKey' . unKey
where
extractKey' (PersistInt64 k) = pack $ show k
extractKey' _ = ""
loginForm :: Form Credentials
loginForm = renderDivs $ Credentials
<$> areq textField "Username" Nothing