Configurable session name
This commit is contained in:
parent
8d0f429c62
commit
4ac413e419
@ -24,7 +24,6 @@ module Yesod.Internal
|
||||
, runUniqueList
|
||||
, toUnique
|
||||
-- * Names
|
||||
, sessionName
|
||||
, tokenKey
|
||||
) where
|
||||
|
||||
@ -98,9 +97,6 @@ newtype Body url = Body (HtmlUrl url)
|
||||
tokenKey :: IsString a => a
|
||||
tokenKey = "_TOKEN"
|
||||
|
||||
sessionName :: IsString a => a
|
||||
sessionName = "_SESSION"
|
||||
|
||||
type CssBuilderUrl a = (a -> [(Text, Text)] -> Text) -> Builder
|
||||
|
||||
data GWData a = GWData
|
||||
|
||||
@ -699,17 +699,18 @@ clientSessionBackend :: Yesod master
|
||||
-> Int -- ^ Inactive session valitity in minutes
|
||||
-> SessionBackend master
|
||||
clientSessionBackend key timeout = SessionBackend
|
||||
{ sbLoadSession = loadClientSession key timeout
|
||||
{ sbLoadSession = loadClientSession key timeout "_SESSION"
|
||||
}
|
||||
|
||||
loadClientSession :: Yesod master
|
||||
=> CS.Key
|
||||
-> Int
|
||||
-> Int -- ^ timeout
|
||||
-> S8.ByteString -- ^ session name
|
||||
-> master
|
||||
-> W.Request
|
||||
-> UTCTime
|
||||
-> IO (BackendSession, SaveSession)
|
||||
loadClientSession key timeout master req now = return (sess, save)
|
||||
loadClientSession key timeout sessionName master req now = return (sess, save)
|
||||
where
|
||||
sess = fromMaybe [] $ do
|
||||
raw <- lookup "Cookie" $ W.requestHeaders req
|
||||
|
||||
Loading…
Reference in New Issue
Block a user