Fixed that autologin is broken when using a custom cookie name (#13335).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11519 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2013-03-02 20:28:21 +00:00
parent 80807a8c49
commit 08ef201cec
3 changed files with 30 additions and 5 deletions
+7 -3
View File
@@ -35,7 +35,7 @@ class ApplicationController < ActionController::Base
protect_from_forgery
def handle_unverified_request
super
cookies.delete(:autologin)
cookies.delete(autologin_cookie_name)
end
before_filter :session_expiration, :user_setup, :check_if_login_required, :set_localization
@@ -127,10 +127,14 @@ class ApplicationController < ActionController::Base
user
end
def autologin_cookie_name
Redmine::Configuration['autologin_cookie_name'].presence || 'autologin'
end
def try_to_autologin
if cookies[:autologin] && Setting.autologin?
if cookies[autologin_cookie_name] && Setting.autologin?
# auto-login feature starts a new session
user = User.try_to_autologin(cookies[:autologin])
user = User.try_to_autologin(cookies[autologin_cookie_name])
if user
reset_session
start_user_session(user)