2015-03-10 23:13:42 +00:00
|
|
|
module Import
|
|
|
|
( module Import
|
|
|
|
) where
|
|
|
|
|
|
|
|
import Foundation as Import
|
|
|
|
import Import.NoFoundation as Import
|
2015-07-20 20:10:30 +00:00
|
|
|
import Yesod.Form.Bootstrap3 as Import
|
|
|
|
|
2015-07-22 00:01:58 +00:00
|
|
|
loginOrDo :: ((Key User, User) -> Handler Html) -> Handler Html
|
2015-07-20 20:10:30 +00:00
|
|
|
loginOrDo cont = do
|
|
|
|
maid <- maybeAuthId
|
|
|
|
muid <- case maid of
|
2015-07-22 00:01:58 +00:00
|
|
|
Just uid -> fmap ((,) uid) <$> (runDB $ get uid)
|
2015-07-20 20:10:30 +00:00
|
|
|
Nothing -> return Nothing
|
|
|
|
case muid of
|
|
|
|
Nothing -> redirect (AuthR LoginR)
|
2015-07-22 00:01:58 +00:00
|
|
|
Just (uid,u) -> cont (uid,u)
|