Removed maybeIdentifier FIXME (RequestReader instance fixed it)

This commit is contained in:
Michael Snoyman 2010-02-17 14:29:42 +02:00
parent 81a6e7a464
commit 47b22ffb49

View File

@ -35,6 +35,7 @@ import Data.Maybe (fromMaybe)
import qualified Network.Wai as W import qualified Network.Wai as W
import Data.Typeable (Typeable) import Data.Typeable (Typeable)
import Control.Exception (Exception) import Control.Exception (Exception)
import Control.Applicative ((<$>))
class YesodApproot a => YesodAuth a where class YesodApproot a => YesodAuth a where
-- | The following breaks DRY, but I cannot think of a better solution -- | The following breaks DRY, but I cannot think of a better solution
@ -198,9 +199,9 @@ authLogout = do
-- | Gets the identifier for a user if available. -- | Gets the identifier for a user if available.
maybeIdentifier :: (Functor m, Monad m, RequestReader m) => m (Maybe String) maybeIdentifier :: (Functor m, Monad m, RequestReader m) => m (Maybe String)
maybeIdentifier = do maybeIdentifier =
rr <- getRawRequest -- FIXME provide version outside of monad? fmap cs . lookup (B8.pack authCookieName) . rawSession
return $ fmap cs $ lookup (B8.pack authCookieName) $ rawSession rr <$> getRawRequest
-- | Gets the display name for a user if available. -- | Gets the display name for a user if available.
displayName :: (Functor m, Monad m, RequestReader m) => m (Maybe String) displayName :: (Functor m, Monad m, RequestReader m) => m (Maybe String)