Merge pull request #1091 from paul-rouse/master

Provide default loginHandler as separate function
This commit is contained in:
Greg Weber 2015-10-21 07:03:06 -07:00
commit 3e84348aab
3 changed files with 25 additions and 10 deletions

View File

@ -1,3 +1,7 @@
## 1.4.9
* Expose defaultLoginHandler
## 1.4.8
* GoogleEmail2: proper error message when permission denied

View File

@ -30,6 +30,7 @@ module Yesod.Auth
-- * User functions
, AuthenticationResult (..)
, defaultMaybeAuthId
, defaultLoginHandler
, maybeAuthPair
, maybeAuth
, requireAuthId
@ -149,16 +150,11 @@ class (Yesod master, PathPiece (AuthId master), RenderMessage master FormMessage
-- | What to show on the login page.
--
-- Default handler concatenates plugin widgets and wraps the result
-- in 'authLayout'. Override if you need fancy widget containers
-- or entirely custom page.
-- By default this calls 'defaultLoginHandler', which concatenates
-- plugin widgets and wraps the result in 'authLayout'. Override if
-- you need fancy widget containers or entirely custom page.
loginHandler :: AuthHandler master Html
loginHandler = do
tp <- getRouteToParent
lift $ authLayout $ do
setTitleI Msg.LoginTitle
master <- getYesod
mapM_ (flip apLogin tp) (authPlugins master)
loginHandler = defaultLoginHandler
-- | Used for i18n of messages provided by this package.
renderAuthMessage :: master
@ -255,6 +251,21 @@ cachedAuth
. getAuthEntity
-- | Default handler to show the login page.
--
-- This is the default 'loginHandler'. It concatenates plugin widgets and
-- wraps the result in 'authLayout'. See 'loginHandler' for more details.
--
-- Since 1.4.9
defaultLoginHandler :: AuthHandler master Html
defaultLoginHandler = do
tp <- getRouteToParent
lift $ authLayout $ do
setTitleI Msg.LoginTitle
master <- getYesod
mapM_ (flip apLogin tp) (authPlugins master)
loginErrorMessageI :: (MonadResourceBase m, YesodAuth master)
=> Route child
-> AuthMessage

View File

@ -1,5 +1,5 @@
name: yesod-auth
version: 1.4.8
version: 1.4.9
license: MIT
license-file: LICENSE
author: Michael Snoyman, Patrick Brisbin