mirror of
https://github.com/redmine/redmine.git
synced 2025-11-02 19:36:00 +01:00
Set autologin cookie as secure by default when using https (#20935).
git-svn-id: http://svn.redmine.org/redmine/trunk@14648 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -265,11 +265,15 @@ class AccountController < ApplicationController
|
|||||||
|
|
||||||
def set_autologin_cookie(user)
|
def set_autologin_cookie(user)
|
||||||
token = Token.create(:user => user, :action => 'autologin')
|
token = Token.create(:user => user, :action => 'autologin')
|
||||||
|
secure = Redmine::Configuration['autologin_cookie_secure']
|
||||||
|
if secure.nil?
|
||||||
|
secure = request.ssl?
|
||||||
|
end
|
||||||
cookie_options = {
|
cookie_options = {
|
||||||
:value => token.value,
|
:value => token.value,
|
||||||
:expires => 1.year.from_now,
|
:expires => 1.year.from_now,
|
||||||
:path => (Redmine::Configuration['autologin_cookie_path'] || '/'),
|
:path => (Redmine::Configuration['autologin_cookie_path'] || '/'),
|
||||||
:secure => (Redmine::Configuration['autologin_cookie_secure'] ? true : false),
|
:secure => secure,
|
||||||
:httponly => true
|
:httponly => true
|
||||||
}
|
}
|
||||||
cookies[autologin_cookie_name] = cookie_options
|
cookies[autologin_cookie_name] = cookie_options
|
||||||
|
|||||||
Reference in New Issue
Block a user