Fixed auth module

This commit is contained in:
Michael Snoyman 2010-07-22 13:03:07 +03:00
parent 0db163aea8
commit e6dc40d582
2 changed files with 5 additions and 11 deletions

View File

@ -79,7 +79,6 @@ module Yesod.Form
, maybeDayInput
, emailInput
-- * Template Haskell
, share2
, mkToForm
) where
@ -807,15 +806,6 @@ runFormGet f = do
gs <- reqGetParams `fmap` getRequest
runFormGeneric gs [] f
-- | This function allows two different monadic functions to share the same
-- input and have their results concatenated. This is particularly useful for
-- allowing 'mkToForm' to share its input with mkPersist.
share2 :: Monad m => (a -> m [b]) -> (a -> m [b]) -> a -> m [b]
share2 f g a = do
f' <- f a
g' <- g a
return $ f' ++ g'
-- | Create 'ToForm' instances for the entities given. In addition to regular 'EntityDef' attributes understood by persistent, it also understands label= and tooltip=.
mkToForm :: String -> [EntityDef] -> Q [Dec]
mkToForm name = mapM derive

View File

@ -51,6 +51,7 @@ import System.IO
import Control.Monad.Attempt
import Data.ByteString.Lazy.UTF8 (fromString)
import Data.Object
import Language.Haskell.TH.Syntax
-- | Minimal complete definition: 'defaultDest' and 'defaultLoginRoute'.
class Yesod master => YesodAuth master where
@ -143,7 +144,10 @@ maybeCreds = do
(y, _):_ -> Just y
_ -> Nothing
mkYesodSub "Auth" [("master", [''YesodAuth])] [$parseRoutes|
mkYesodSub "Auth"
[ ClassP ''YesodAuth [VarT $ mkName "master"]
]
[$parseRoutes|
/check Check GET
/logout Logout GET
/openid OpenIdR GET