2016-10-27 12:15:58 +08:00
|
|
|
class ActionDispatch::Session::DiscourseCookieStore < ActionDispatch::Session::CookieStore
|
2017-07-28 09:20:09 +08:00
|
|
|
def initialize(app, options = {})
|
|
|
|
super(app, options)
|
2016-10-27 12:15:58 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def set_cookie(request, session_id, cookie)
|
|
|
|
if Hash === cookie
|
|
|
|
if SiteSetting.force_https
|
|
|
|
cookie[:secure] = true
|
|
|
|
end
|
2017-02-24 01:01:28 +08:00
|
|
|
unless SiteSetting.same_site_cookies == "Disabled"
|
|
|
|
cookie[:same_site] = SiteSetting.same_site_cookies
|
|
|
|
end
|
2016-10-27 12:15:58 +08:00
|
|
|
end
|
|
|
|
cookie_jar(request)[@key] = cookie
|
|
|
|
end
|
|
|
|
end
|