Helper expanded
This commit is contained in:
parent
0ab0552f20
commit
c8ee577f38
3 changed files with 8 additions and 6 deletions
|
@ -35,12 +35,6 @@ 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
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
module Helper
|
module Helper
|
||||||
( getUserIdFromText
|
( getUserIdFromText
|
||||||
|
, extractKey
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
|
|
||||||
|
@ -10,3 +11,9 @@ import Database.Persist.Types
|
||||||
getUserIdFromText :: Text -> PersistValue
|
getUserIdFromText :: Text -> PersistValue
|
||||||
getUserIdFromText tempUserId =
|
getUserIdFromText tempUserId =
|
||||||
PersistInt64 $ fromIntegral $ read $ unpack tempUserId
|
PersistInt64 $ fromIntegral $ read $ unpack tempUserId
|
||||||
|
|
||||||
|
extractKey :: KeyBackend backend entity -> Text
|
||||||
|
extractKey = extractKey' . unKey
|
||||||
|
where
|
||||||
|
extractKey' (PersistInt64 k) = pack $ show k
|
||||||
|
extractKey' _ = ""
|
||||||
|
|
|
@ -14,6 +14,7 @@ Flag library-only
|
||||||
library
|
library
|
||||||
exposed-modules: Application
|
exposed-modules: Application
|
||||||
Foundation
|
Foundation
|
||||||
|
Helper
|
||||||
Import
|
Import
|
||||||
Model
|
Model
|
||||||
Settings
|
Settings
|
||||||
|
|
Loading…
Reference in a new issue