mirror of
https://github.com/discourse/discourse.git
synced 2024-12-05 11:15:49 +08:00
30990006a9
This reduces chances of errors where consumers of strings mutate inputs and reduces memory usage of the app. Test suite passes now, but there may be some stuff left, so we will run a few sites on a branch prior to merging
22 lines
526 B
Ruby
22 lines
526 B
Ruby
# frozen_string_literal: true
|
|
|
|
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
|
|
if SiteSetting.force_https
|
|
cookie[:secure] = true
|
|
end
|
|
unless SiteSetting.same_site_cookies == "Disabled"
|
|
cookie[:same_site] = SiteSetting.same_site_cookies
|
|
end
|
|
end
|
|
cookie_jar(request)[@key] = cookie
|
|
end
|
|
end
|