Remove liftHandler

This commit is contained in:
Michael Snoyman 2011-01-31 13:26:50 +02:00
parent 66ee5f4c96
commit 71f3170ec8
4 changed files with 14 additions and 10 deletions

View File

@ -37,6 +37,7 @@ import Text.Hamlet (hamlet)
import Data.Text.Lazy (pack)
import Data.JSON.Types (Value (..), Atom (AtomBoolean))
import qualified Data.Map as Map
import Control.Monad.Trans.Class (lift)
data Auth = Auth
@ -81,7 +82,7 @@ class Yesod m => YesodAuth m where
loginHandler :: GHandler Auth m RepHtml
loginHandler = defaultLayout $ do
setTitle $ string "Login"
tm <- liftHandler getRouteToMaster
tm <- lift getRouteToMaster
mapM_ (flip apLogin tm) authPlugins
----- Message strings. In theory in the future make this localizable

View File

@ -23,6 +23,7 @@ import Yesod.Widget
import Yesod.Core
import Text.Hamlet (hamlet)
import Control.Monad.IO.Class (liftIO)
import Control.Monad.Trans.Class (lift)
login, register, setpass :: AuthRoute
login = PluginR "email" ["login"]
@ -71,7 +72,7 @@ class YesodAuth m => YesodAuthEmail m where
authEmail :: YesodAuthEmail m => AuthPlugin m
authEmail =
AuthPlugin "email" dispatch $ \tm -> do
y <- liftHandler getYesod
y <- lift getYesod
#if GHC7
[hamlet|
#else

View File

@ -15,6 +15,8 @@ import Yesod.Handler
import Yesod.Widget
import Text.Hamlet (hamlet)
import Control.Monad.IO.Class (liftIO)
import qualified Data.ByteString.Char8 as S8
import Control.Monad.Trans.Class (lift)
facebookUrl :: AuthRoute
facebookUrl = PluginR "facebook" ["forward"]
@ -32,7 +34,7 @@ authFacebook cid secret perms =
tm <- getRouteToMaster
render <- getUrlRender
let fb = Facebook.Facebook cid secret $ render $ tm url
redirectString RedirectTemporary $ Facebook.getForwardUrl fb perms
redirectString RedirectTemporary $ S8.pack $ Facebook.getForwardUrl fb perms
dispatch "GET" [] = do
render <- getUrlRender
tm <- getRouteToMaster
@ -56,10 +58,10 @@ authFacebook cid secret perms =
setCreds True c
dispatch _ _ = notFound
login tm = do
render <- liftHandler getUrlRender
render <- lift getUrlRender
let fb = Facebook.Facebook cid secret $ render $ tm url
let furl = Facebook.getForwardUrl fb $ perms
y <- liftHandler getYesod
y <- lift getYesod
addHtml
#if GHC7
[hamlet|

View File

@ -17,6 +17,7 @@ import Text.Hamlet (hamlet)
import Text.Cassius (cassius)
import Text.Blaze (string)
import Control.Monad.Trans.Class (lift)
import qualified Data.ByteString.Char8 as S8
forwardUrl :: AuthRoute
forwardUrl = PluginR "openid" ["forward"]
@ -28,8 +29,8 @@ authOpenId =
complete = PluginR "openid" ["complete"]
name = "openid_identifier"
login tm = do
ident <- newIdent
y <- liftHandler getYesod
ident <- lift newIdent
y <- lift getYesod
addCassius
#if GHC7
[cassius|##{ident}
@ -64,7 +65,7 @@ authOpenId =
setMessage $ string $ show err
redirect RedirectTemporary $ toMaster LoginR
)
(redirectString RedirectTemporary)
(redirectString RedirectTemporary . S8.pack)
res
_ -> do
toMaster <- getRouteToMaster
@ -74,8 +75,7 @@ authOpenId =
rr <- getRequest
completeHelper $ reqGetParams rr
dispatch "POST" ["complete"] = do
rr <- getRequest
(posts, _) <- lift $ reqRequestBody rr
(posts, _) <- runRequestBody
completeHelper posts
dispatch _ _ = notFound