2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-10-27 00:15:58 -04:00
|
|
|
class ActionDispatch::Session::DiscourseCookieStore < ActionDispatch::Session::CookieStore
|
|
|
|
def initialize(app, options = {})
|
|
|
|
super(app, options)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def set_cookie(request, session_id, cookie)
|
|
|
|
if Hash === cookie
|
|
|
|
cookie[:secure] = true if SiteSetting.force_https
|
2017-02-23 12:01:28 -05:00
|
|
|
unless SiteSetting.same_site_cookies == "Disabled"
|
|
|
|
cookie[:same_site] = SiteSetting.same_site_cookies
|
|
|
|
end
|
2016-10-27 00:15:58 -04:00
|
|
|
end
|
|
|
|
cookie_jar(request)[@key] = cookie
|
|
|
|
end
|
|
|
|
end
|