This commit is contained in:
Alexey Khudyakov 2011-06-05 21:50:07 +04:00
parent e81a636020
commit 233d53258f

View File

@ -31,6 +31,7 @@ import Language.Haskell.TH.Syntax hiding (lift)
import qualified Network.Wai as W
import Text.Hamlet (hamlet)
import qualified Data.Map as Map
import Control.Monad (when)
import Control.Monad.Trans.Class (lift)
import Data.Aeson
import Data.Text (Text)
@ -110,24 +111,17 @@ setCreds doRedirects creds = do
maid <- getAuthId creds
case maid of
Nothing ->
if doRedirects
then do
when doRedirects $ do
case authRoute y of
Nothing -> do
rh <- defaultLayout
[QQ(hamlet)| <h1>Invalid login |]
Nothing -> do rh <- defaultLayout [QQ(hamlet)| <h1>Invalid login |]
sendResponse rh
Just ar -> do
setMessageI Msg.InvalidLogin
Just ar -> do setMessageI Msg.InvalidLogin
redirect RedirectTemporary ar
else return ()
Just aid -> do
setSession credsKey $ toSinglePiece aid
if doRedirects
then do
when doRedirects $ do
setMessageI Msg.NowLoggedIn
redirectUltDest RedirectTemporary $ loginDest y
else return ()
getCheckR :: YesodAuth m => GHandler Auth m RepHtmlJson
getCheckR = do