{-# LANGUAGE CPP #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
module Snap.Snaplet.Auth.SpliceHelpers
( addAuthSplices
, compiledAuthSplices
, userCSplices
, userISplices
, ifLoggedIn
, ifLoggedOut
, loggedInUser
, cIfLoggedIn
, cIfLoggedOut
, cLoggedInUser
) where
import Control.Lens
import Control.Monad.Trans
import Data.Map.Syntax ((##), mapV)
import Data.Maybe
import qualified Data.Text as T
import Data.Text.Encoding
import qualified Text.XmlHtml as X
import Heist
import qualified Heist.Interpreted as I
import qualified Heist.Compiled as C
import Heist.Splices
import Snap.Snaplet
import Snap.Snaplet.Auth.AuthManager
import Snap.Snaplet.Auth.Handlers
import Snap.Snaplet.Auth.Types
import Snap.Snaplet.Heist
#if !MIN_VERSION_base(4,8,0)
import Data.Monoid
#endif
addAuthSplices
:: HasHeist b
=> Snaplet (Heist b)
-> SnapletLens b (AuthManager b)
-> Initializer b v ()
addAuthSplices :: forall b v.
HasHeist b =>
Snaplet (Heist b)
-> SnapletLens b (AuthManager b) -> Initializer b v ()
addAuthSplices Snaplet (Heist b)
h SnapletLens b (AuthManager b)
auth = forall b v.
Snaplet (Heist b)
-> SpliceConfig (Handler b b) -> Initializer b v ()
addConfig Snaplet (Heist b)
h SpliceConfig (Handler b b)
sc
where
sc :: SpliceConfig (Handler b b)
sc = forall a. Monoid a => a
mempty forall a b. a -> (a -> b) -> b
& forall (f :: * -> *) (m :: * -> *).
Functor f =>
(Splices (Splice m) -> f (Splices (Splice m)))
-> SpliceConfig m -> f (SpliceConfig m)
scInterpretedSplices forall s t a b. ASetter s t a b -> b -> s -> t
.~ MapSyntaxM Text (SnapletISplice b) ()
is
forall a b. a -> (a -> b) -> b
& forall (f :: * -> *) (m :: * -> *).
Functor f =>
(Splices (Splice m) -> f (Splices (Splice m)))
-> SpliceConfig m -> f (SpliceConfig m)
scCompiledSplices forall s t a b. ASetter s t a b -> b -> s -> t
.~ Splices (SnapletCSplice b)
cs
is :: MapSyntaxM Text (SnapletISplice b) ()
is = do
Text
"ifLoggedIn" forall k v. k -> v -> MapSyntax k v
## forall b. SnapletLens b (AuthManager b) -> SnapletISplice b
ifLoggedIn SnapletLens b (AuthManager b)
auth
Text
"ifLoggedOut" forall k v. k -> v -> MapSyntax k v
## forall b. SnapletLens b (AuthManager b) -> SnapletISplice b
ifLoggedOut SnapletLens b (AuthManager b)
auth
Text
"loggedInUser" forall k v. k -> v -> MapSyntax k v
## forall b. SnapletLens b (AuthManager b) -> SnapletISplice b
loggedInUser SnapletLens b (AuthManager b)
auth
cs :: Splices (SnapletCSplice b)
cs = forall b.
SnapletLens b (AuthManager b) -> Splices (SnapletCSplice b)
compiledAuthSplices SnapletLens b (AuthManager b)
auth
compiledAuthSplices :: SnapletLens b (AuthManager b)
-> Splices (SnapletCSplice b)
compiledAuthSplices :: forall b.
SnapletLens b (AuthManager b) -> Splices (SnapletCSplice b)
compiledAuthSplices SnapletLens b (AuthManager b)
auth = do
Text
"ifLoggedIn" forall k v. k -> v -> MapSyntax k v
## forall b. SnapletLens b (AuthManager b) -> SnapletCSplice b
cIfLoggedIn SnapletLens b (AuthManager b)
auth
Text
"ifLoggedOut" forall k v. k -> v -> MapSyntax k v
## forall b. SnapletLens b (AuthManager b) -> SnapletCSplice b
cIfLoggedOut SnapletLens b (AuthManager b)
auth
Text
"loggedInUser" forall k v. k -> v -> MapSyntax k v
## forall b. SnapletLens b (AuthManager b) -> SnapletCSplice b
cLoggedInUser SnapletLens b (AuthManager b)
auth
userISplices :: Monad m => AuthUser -> Splices (I.Splice m)
userISplices :: forall (m :: * -> *). Monad m => AuthUser -> Splices (Splice m)
userISplices AuthUser{Int
[Role]
Maybe UTCTime
Maybe ByteString
Maybe Text
Maybe UserId
Maybe Password
Text
HashMap Text Value
userMeta :: AuthUser -> HashMap Text Value
userRoles :: AuthUser -> [Role]
userResetRequestedAt :: AuthUser -> Maybe UTCTime
userResetToken :: AuthUser -> Maybe Text
userUpdatedAt :: AuthUser -> Maybe UTCTime
userCreatedAt :: AuthUser -> Maybe UTCTime
userLastLoginIp :: AuthUser -> Maybe ByteString
userCurrentLoginIp :: AuthUser -> Maybe ByteString
userLastLoginAt :: AuthUser -> Maybe UTCTime
userCurrentLoginAt :: AuthUser -> Maybe UTCTime
userLockedOutUntil :: AuthUser -> Maybe UTCTime
userFailedLoginCount :: AuthUser -> Int
userLoginCount :: AuthUser -> Int
userRememberToken :: AuthUser -> Maybe Text
userSuspendedAt :: AuthUser -> Maybe UTCTime
userActivatedAt :: AuthUser -> Maybe UTCTime
userPassword :: AuthUser -> Maybe Password
userEmail :: AuthUser -> Maybe Text
userLogin :: AuthUser -> Text
userId :: AuthUser -> Maybe UserId
userMeta :: HashMap Text Value
userRoles :: [Role]
userResetRequestedAt :: Maybe UTCTime
userResetToken :: Maybe Text
userUpdatedAt :: Maybe UTCTime
userCreatedAt :: Maybe UTCTime
userLastLoginIp :: Maybe ByteString
userCurrentLoginIp :: Maybe ByteString
userLastLoginAt :: Maybe UTCTime
userCurrentLoginAt :: Maybe UTCTime
userLockedOutUntil :: Maybe UTCTime
userFailedLoginCount :: Int
userLoginCount :: Int
userRememberToken :: Maybe Text
userSuspendedAt :: Maybe UTCTime
userActivatedAt :: Maybe UTCTime
userPassword :: Maybe Password
userEmail :: Maybe Text
userLogin :: Text
userId :: Maybe UserId
..} = do
Text
"userId" forall k v. k -> v -> MapSyntax k v
## forall (m :: * -> *) (n :: * -> *).
Monad m =>
Text -> HeistT n m Template
I.textSplice forall a b. (a -> b) -> a -> b
$ forall b a. b -> (a -> b) -> Maybe a -> b
maybe Text
"-" UserId -> Text
unUid Maybe UserId
userId
Text
"userLogin" forall k v. k -> v -> MapSyntax k v
## forall (m :: * -> *) (n :: * -> *).
Monad m =>
Text -> HeistT n m Template
I.textSplice Text
userLogin
Text
"userEmail" forall k v. k -> v -> MapSyntax k v
## forall (m :: * -> *) (n :: * -> *).
Monad m =>
Text -> HeistT n m Template
I.textSplice forall a b. (a -> b) -> a -> b
$ forall a. a -> Maybe a -> a
fromMaybe Text
"-" Maybe Text
userEmail
Text
"userActive" forall k v. k -> v -> MapSyntax k v
## forall (m :: * -> *) (n :: * -> *).
Monad m =>
Text -> HeistT n m Template
I.textSplice forall a b. (a -> b) -> a -> b
$ String -> Text
T.pack forall a b. (a -> b) -> a -> b
$ forall a. Show a => a -> String
show forall a b. (a -> b) -> a -> b
$ forall a. Maybe a -> Bool
isNothing Maybe UTCTime
userSuspendedAt
Text
"userLoginCount" forall k v. k -> v -> MapSyntax k v
## forall (m :: * -> *) (n :: * -> *).
Monad m =>
Text -> HeistT n m Template
I.textSplice forall a b. (a -> b) -> a -> b
$ String -> Text
T.pack forall a b. (a -> b) -> a -> b
$ forall a. Show a => a -> String
show Int
userLoginCount
Text
"userFailedCount" forall k v. k -> v -> MapSyntax k v
## forall (m :: * -> *) (n :: * -> *).
Monad m =>
Text -> HeistT n m Template
I.textSplice forall a b. (a -> b) -> a -> b
$ String -> Text
T.pack forall a b. (a -> b) -> a -> b
$ forall a. Show a => a -> String
show Int
userFailedLoginCount
Text
"userLoginAt" forall k v. k -> v -> MapSyntax k v
## forall (m :: * -> *) (n :: * -> *).
Monad m =>
Text -> HeistT n m Template
I.textSplice forall a b. (a -> b) -> a -> b
$ forall b a. b -> (a -> b) -> Maybe a -> b
maybe Text
"-" (String -> Text
T.pack forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => a -> String
show) Maybe UTCTime
userCurrentLoginAt
Text
"userLastLoginAt" forall k v. k -> v -> MapSyntax k v
## forall (m :: * -> *) (n :: * -> *).
Monad m =>
Text -> HeistT n m Template
I.textSplice forall a b. (a -> b) -> a -> b
$ forall b a. b -> (a -> b) -> Maybe a -> b
maybe Text
"-" (String -> Text
T.pack forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => a -> String
show) Maybe UTCTime
userLastLoginAt
Text
"userSuspendedAt" forall k v. k -> v -> MapSyntax k v
## forall (m :: * -> *) (n :: * -> *).
Monad m =>
Text -> HeistT n m Template
I.textSplice forall a b. (a -> b) -> a -> b
$ forall b a. b -> (a -> b) -> Maybe a -> b
maybe Text
"-" (String -> Text
T.pack forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => a -> String
show) Maybe UTCTime
userSuspendedAt
Text
"userLoginIP" forall k v. k -> v -> MapSyntax k v
## forall (m :: * -> *) (n :: * -> *).
Monad m =>
Text -> HeistT n m Template
I.textSplice forall a b. (a -> b) -> a -> b
$ forall b a. b -> (a -> b) -> Maybe a -> b
maybe Text
"-" ByteString -> Text
decodeUtf8 Maybe ByteString
userCurrentLoginIp
Text
"userLastLoginIP" forall k v. k -> v -> MapSyntax k v
## forall (m :: * -> *) (n :: * -> *).
Monad m =>
Text -> HeistT n m Template
I.textSplice forall a b. (a -> b) -> a -> b
$ forall b a. b -> (a -> b) -> Maybe a -> b
maybe Text
"-" ByteString -> Text
decodeUtf8 Maybe ByteString
userLastLoginIp
Text
"userIfActive" forall k v. k -> v -> MapSyntax k v
## forall (m :: * -> *). Monad m => Bool -> Splice m
ifISplice forall a b. (a -> b) -> a -> b
$ forall a. Maybe a -> Bool
isNothing Maybe UTCTime
userSuspendedAt
Text
"userIfSuspended" forall k v. k -> v -> MapSyntax k v
## forall (m :: * -> *). Monad m => Bool -> Splice m
ifISplice forall a b. (a -> b) -> a -> b
$ forall a. Maybe a -> Bool
isJust Maybe UTCTime
userSuspendedAt
userCSplices :: Monad m => Splices (RuntimeSplice m AuthUser -> C.Splice m)
userCSplices :: forall (m :: * -> *).
Monad m =>
Splices (RuntimeSplice m AuthUser -> Splice m)
userCSplices = forall {n :: * -> *} {k}.
(Monad n, IsString k) =>
MapSyntax k (RuntimeSplice n AuthUser -> Splice n)
fields forall a. Monoid a => a -> a -> a
`mappend` forall {k} {m :: * -> *}.
(IsString k, Monad m) =>
MapSyntaxM k (RuntimeSplice m AuthUser -> Splice m) ()
ifs
where
fields :: MapSyntax k (RuntimeSplice n AuthUser -> Splice n)
fields = forall v1 v2 k a. (v1 -> v2) -> MapSyntaxM k v1 a -> MapSyntax k v2
mapV (forall (n :: * -> *) a.
Monad n =>
(a -> Builder) -> RuntimeSplice n a -> Splice n
C.pureSplice forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. (a -> Text) -> a -> Builder
C.textSplice) forall a b. (a -> b) -> a -> b
$ do
k
"userId" forall k v. k -> v -> MapSyntax k v
## forall b a. b -> (a -> b) -> Maybe a -> b
maybe Text
"-" UserId -> Text
unUid forall b c a. (b -> c) -> (a -> b) -> a -> c
. AuthUser -> Maybe UserId
userId
k
"userLogin" forall k v. k -> v -> MapSyntax k v
## AuthUser -> Text
userLogin
k
"userEmail" forall k v. k -> v -> MapSyntax k v
## forall a. a -> Maybe a -> a
fromMaybe Text
"-" forall b c a. (b -> c) -> (a -> b) -> a -> c
. AuthUser -> Maybe Text
userEmail
k
"userActive" forall k v. k -> v -> MapSyntax k v
## String -> Text
T.pack forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Maybe a -> Bool
isNothing forall b c a. (b -> c) -> (a -> b) -> a -> c
. AuthUser -> Maybe UTCTime
userSuspendedAt
k
"userLoginCount" forall k v. k -> v -> MapSyntax k v
## String -> Text
T.pack forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. AuthUser -> Int
userLoginCount
k
"userFailedCount" forall k v. k -> v -> MapSyntax k v
## String -> Text
T.pack forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => a -> String
show forall b c a. (b -> c) -> (a -> b) -> a -> c
. AuthUser -> Int
userFailedLoginCount
k
"userLoginAt" forall k v. k -> v -> MapSyntax k v
## forall b a. b -> (a -> b) -> Maybe a -> b
maybe Text
"-" (String -> Text
T.pack forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => a -> String
show) forall b c a. (b -> c) -> (a -> b) -> a -> c
. AuthUser -> Maybe UTCTime
userCurrentLoginAt
k
"userLastLoginAt" forall k v. k -> v -> MapSyntax k v
## forall b a. b -> (a -> b) -> Maybe a -> b
maybe Text
"-" (String -> Text
T.pack forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => a -> String
show) forall b c a. (b -> c) -> (a -> b) -> a -> c
. AuthUser -> Maybe UTCTime
userLastLoginAt
k
"userSuspendedAt" forall k v. k -> v -> MapSyntax k v
## forall b a. b -> (a -> b) -> Maybe a -> b
maybe Text
"-" (String -> Text
T.pack forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => a -> String
show) forall b c a. (b -> c) -> (a -> b) -> a -> c
. AuthUser -> Maybe UTCTime
userSuspendedAt
k
"userLoginIP" forall k v. k -> v -> MapSyntax k v
## forall b a. b -> (a -> b) -> Maybe a -> b
maybe Text
"-" ByteString -> Text
decodeUtf8 forall b c a. (b -> c) -> (a -> b) -> a -> c
. AuthUser -> Maybe ByteString
userCurrentLoginIp
k
"userLastLoginIP" forall k v. k -> v -> MapSyntax k v
## forall b a. b -> (a -> b) -> Maybe a -> b
maybe Text
"-" ByteString -> Text
decodeUtf8 forall b c a. (b -> c) -> (a -> b) -> a -> c
. AuthUser -> Maybe ByteString
userLastLoginIp
ifs :: MapSyntaxM k (RuntimeSplice m AuthUser -> Splice m) ()
ifs = do
k
"userIfActive" forall k v. k -> v -> MapSyntax k v
## forall (m :: * -> *) t.
Monad m =>
(t -> Bool) -> RuntimeSplice m t -> Splice m
ifCSplice (forall a. Maybe a -> Bool
isNothing forall b c a. (b -> c) -> (a -> b) -> a -> c
. AuthUser -> Maybe UTCTime
userSuspendedAt)
k
"userIfSuspended" forall k v. k -> v -> MapSyntax k v
## forall (m :: * -> *) t.
Monad m =>
(t -> Bool) -> RuntimeSplice m t -> Splice m
ifCSplice (forall a. Maybe a -> Bool
isJust forall b c a. (b -> c) -> (a -> b) -> a -> c
. AuthUser -> Maybe UTCTime
userSuspendedAt)
ifLoggedIn :: SnapletLens b (AuthManager b) -> SnapletISplice b
ifLoggedIn :: forall b. SnapletLens b (AuthManager b) -> SnapletISplice b
ifLoggedIn SnapletLens b (AuthManager b)
auth = do
Bool
chk <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (m :: * -> * -> * -> *) b v' a v.
MonadSnaplet m =>
SnapletLens b v' -> m b v' a -> m b v a
withTop SnapletLens b (AuthManager b)
auth forall b. Handler b (AuthManager b) Bool
isLoggedIn
case Bool
chk of
Bool
True -> forall (m :: * -> *) (n :: * -> *). Monad m => HeistT n m Node
getParamNode forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= forall (m :: * -> *) a. Monad m => a -> m a
return forall b c a. (b -> c) -> (a -> b) -> a -> c
. Node -> Template
X.childNodes
Bool
False -> forall (m :: * -> *) a. Monad m => a -> m a
return []
cIfLoggedIn :: SnapletLens b (AuthManager b) -> SnapletCSplice b
cIfLoggedIn :: forall b. SnapletLens b (AuthManager b) -> SnapletCSplice b
cIfLoggedIn SnapletLens b (AuthManager b)
auth = do
DList (Chunk (Handler b b))
cs <- forall (n :: * -> *). Monad n => Splice n
C.runChildren
forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ forall (n :: * -> *). RuntimeSplice n Builder -> DList (Chunk n)
C.yieldRuntime forall a b. (a -> b) -> a -> b
$ do
Bool
chk <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (m :: * -> * -> * -> *) b v' a v.
MonadSnaplet m =>
SnapletLens b v' -> m b v' a -> m b v a
withTop SnapletLens b (AuthManager b)
auth forall b. Handler b (AuthManager b) Bool
isLoggedIn
case Bool
chk of
Bool
True -> forall (n :: * -> *).
Monad n =>
DList (Chunk n) -> RuntimeSplice n Builder
C.codeGen DList (Chunk (Handler b b))
cs
Bool
False -> forall a. Monoid a => a
mempty
ifLoggedOut :: SnapletLens b (AuthManager b) -> SnapletISplice b
ifLoggedOut :: forall b. SnapletLens b (AuthManager b) -> SnapletISplice b
ifLoggedOut SnapletLens b (AuthManager b)
auth = do
Bool
chk <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (m :: * -> * -> * -> *) b v' a v.
MonadSnaplet m =>
SnapletLens b v' -> m b v' a -> m b v a
withTop SnapletLens b (AuthManager b)
auth forall b. Handler b (AuthManager b) Bool
isLoggedIn
case Bool
chk of
Bool
False -> forall (m :: * -> *) (n :: * -> *). Monad m => HeistT n m Node
getParamNode forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= forall (m :: * -> *) a. Monad m => a -> m a
return forall b c a. (b -> c) -> (a -> b) -> a -> c
. Node -> Template
X.childNodes
Bool
True -> forall (m :: * -> *) a. Monad m => a -> m a
return []
cIfLoggedOut :: SnapletLens b (AuthManager b) -> SnapletCSplice b
cIfLoggedOut :: forall b. SnapletLens b (AuthManager b) -> SnapletCSplice b
cIfLoggedOut SnapletLens b (AuthManager b)
auth = do
DList (Chunk (Handler b b))
cs <- forall (n :: * -> *). Monad n => Splice n
C.runChildren
forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ forall (n :: * -> *). RuntimeSplice n Builder -> DList (Chunk n)
C.yieldRuntime forall a b. (a -> b) -> a -> b
$ do
Bool
chk <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (m :: * -> * -> * -> *) b v' a v.
MonadSnaplet m =>
SnapletLens b v' -> m b v' a -> m b v a
withTop SnapletLens b (AuthManager b)
auth forall b. Handler b (AuthManager b) Bool
isLoggedIn
case Bool
chk of
Bool
False -> forall (n :: * -> *).
Monad n =>
DList (Chunk n) -> RuntimeSplice n Builder
C.codeGen DList (Chunk (Handler b b))
cs
Bool
True -> forall a. Monoid a => a
mempty
loggedInUser :: SnapletLens b (AuthManager b) -> SnapletISplice b
loggedInUser :: forall b. SnapletLens b (AuthManager b) -> SnapletISplice b
loggedInUser SnapletLens b (AuthManager b)
auth = do
Maybe AuthUser
u <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (m :: * -> * -> * -> *) b v' a v.
MonadSnaplet m =>
SnapletLens b v' -> m b v' a -> m b v a
withTop SnapletLens b (AuthManager b)
auth forall b. Handler b (AuthManager b) (Maybe AuthUser)
currentUser
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (forall (m :: * -> *) a. Monad m => a -> m a
return []) (forall (m :: * -> *) (n :: * -> *).
Monad m =>
Text -> HeistT n m Template
I.textSplice forall b c a. (b -> c) -> (a -> b) -> a -> c
. AuthUser -> Text
userLogin) Maybe AuthUser
u
cLoggedInUser :: SnapletLens b (AuthManager b) -> SnapletCSplice b
cLoggedInUser :: forall b. SnapletLens b (AuthManager b) -> SnapletCSplice b
cLoggedInUser SnapletLens b (AuthManager b)
auth =
forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ forall (n :: * -> *).
Monad n =>
RuntimeSplice n Text -> DList (Chunk n)
C.yieldRuntimeText forall a b. (a -> b) -> a -> b
$ do
Maybe AuthUser
u <- forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall a b. (a -> b) -> a -> b
$ forall (m :: * -> * -> * -> *) b v' a v.
MonadSnaplet m =>
SnapletLens b v' -> m b v' a -> m b v a
withTop SnapletLens b (AuthManager b)
auth forall b. Handler b (AuthManager b) (Maybe AuthUser)
currentUser
forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ forall b a. b -> (a -> b) -> Maybe a -> b
maybe Text
"" AuthUser -> Text
userLogin Maybe AuthUser
u