From 9cd7a0ba14175f315ee6556bd9306ab6608b6daf Mon Sep 17 00:00:00 2001 From: Felipe Lessa Date: Wed, 21 Mar 2012 14:36:46 -0300 Subject: [PATCH] Add cookieDomain to Yesod type class. --- yesod-core/Yesod/Internal/Core.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/yesod-core/Yesod/Internal/Core.hs b/yesod-core/Yesod/Internal/Core.hs index 5fb9d7af..89ebca32 100644 --- a/yesod-core/Yesod/Internal/Core.hs +++ b/yesod-core/Yesod/Internal/Core.hs @@ -274,6 +274,12 @@ class RenderRoute a => Yesod a where cookiePath :: a -> S8.ByteString cookiePath _ = "/" + -- | The domain value to set for cookies. By default, the + -- domain is not set, meaning cookies will be sent only to + -- the current domain. + cookieDomain :: a -> Maybe S8.ByteString + cookieDomain _ = Nothing + -- | Maximum allowed length of the request body, in bytes. maximumContentLength :: a -> Maybe (Route a) -> Int maximumContentLength _ _ = 2 * 1024 * 1024 -- 2 megabytes @@ -742,7 +748,7 @@ saveClientSession key timeout master _ now _ sess = do , setCookieValue = sessionVal iv , setCookiePath = Just (cookiePath master) , setCookieExpires = Just expires - , setCookieDomain = Nothing + , setCookieDomain = cookieDomain master , setCookieHttpOnly = True }] where