From e6dc40d58284b7de33115b6e8540a36cff56e97a Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Thu, 22 Jul 2010 13:03:07 +0300 Subject: [PATCH] Fixed auth module --- Yesod/Form.hs | 10 ---------- Yesod/Helpers/Auth.hs | 6 +++++- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/Yesod/Form.hs b/Yesod/Form.hs index b75cf36d..fcb32fae 100644 --- a/Yesod/Form.hs +++ b/Yesod/Form.hs @@ -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 diff --git a/Yesod/Helpers/Auth.hs b/Yesod/Helpers/Auth.hs index d8837345..d0b71450 100644 --- a/Yesod/Helpers/Auth.hs +++ b/Yesod/Helpers/Auth.hs @@ -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