neat/Import.hs

18 lines
587 B
Haskell
Raw Normal View History

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