yesodweb/yesod — Issue #228: yesod-auth - login/logout generalization
Author: paronsson
Created: 2012-01-17 23:58:18+00:00
State: open

Proposal to add functions for successful login and logout to allow different kinds of UI mechanisms.

Sorry for not sending a pull request (that was my intention). I got lost in my first use of Git + cabal + cabal-src + virthualenv, build errors, etc. I will get into it.

Below are my proposals for modifications. I hope they are correct.

YesodAuth class - Two new functions

-- | Called upon successful login
loggedIn :: GHandler s m ()
loggedIn = setMessageI Msg.NowLoggedIn

-- | Called upon successful logout
loggedOut :: GHandler Auth m ()
loggedOut = return ()

setCreds - Just change 1 line

setMessageI Msg.NowLoggedIn

changed to

loggedIn

postLogoutR - 1 added line

postLogoutR = do
y <- getYesod
deleteSession credsKey
loggedOut -- ADDED LINE
redirectUltDest $ logoutDest y