diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 75be302cd..dc1cceb87 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -336,7 +336,7 @@ class AccountController < ApplicationController :expires => 1.month.from_now, :path => (Redmine::Configuration['autologin_cookie_path'] || '/'), :secure => (Redmine::Configuration['autologin_cookie_secure'] ? true : false), - :domain => '.trustie.net', + :domain => Redmine::Configuration['cookie_domain'], :httponly => true } cookies[autologin_cookie_name] = cookie_options diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0dc86fb01..02b2f0d1d 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -199,7 +199,7 @@ class ApplicationController < ActionController::Base # Logs out current user def logout_user if User.current.logged? - cookies.delete(autologin_cookie_name) + cookies.delete(autologin_cookie_name, domain: Redmine::Configuration['cookie_domain']) # Token.delete_all(["user_id = ? AND action = ?", User.current.id, 'autologin']) self.logged_user = nil end diff --git a/config/configuration.yml b/config/configuration.yml index 87a54a976..45e307157 100644 --- a/config/configuration.yml +++ b/config/configuration.yml @@ -90,6 +90,7 @@ default: user_name: "huang.jingquan@163.com" password: 'xinhu1ji2qu366' + cookie_domain: ".trustie.net" # Absolute path to the directory where attachments are stored. # The default is the 'files' directory in your Redmine instance. # Your Redmine instance needs to have write permission on this