Configurable session name

This commit is contained in:
Michael Snoyman 2012-04-07 23:01:29 +03:00
parent 8d0f429c62
commit 4ac413e419
2 changed files with 4 additions and 7 deletions

View File

@ -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

View File

@ -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