mirror of
https://github.com/discourse/discourse.git
synced 2025-09-05 08:59:27 +08:00
FIX: force secure cookies on session if force https is enabled
This commit is contained in:
parent
004e71a3fe
commit
9848e26190
2 changed files with 19 additions and 1 deletions
16
lib/discourse_cookie_store.rb
Normal file
16
lib/discourse_cookie_store.rb
Normal file
|
@ -0,0 +1,16 @@
|
|||
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
|
||||
end
|
||||
cookie_jar(request)[@key] = cookie
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue