From a010372458bc529075c9b4d6c89d2863be0503c3 2013-03-02 20:30:57 From: Jean-Philippe Lang Date: 2013-03-02 20:30:57 Subject: [PATCH] Fixed that autologin cookie is not deleted when using custom cookie name (#13335). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11520 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 9948e71..6bbc4d1 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -157,7 +157,7 @@ class ApplicationController < ActionController::Base # Logs out current user def logout_user if User.current.logged? - cookies.delete :autologin + cookies.delete(autologin_cookie_name) Token.delete_all(["user_id = ? AND action = ?", User.current.id, 'autologin']) self.logged_user = nil end diff --git a/test/integration/account_test.rb b/test/integration/account_test.rb index bdd9cb5..de78ba7 100644 --- a/test/integration/account_test.rb +++ b/test/integration/account_test.rb @@ -87,6 +87,11 @@ class AccountTest < ActionController::IntegrationTest cookies['custom_autologin'] = token get '/my/page' assert_response :success + + assert_difference 'Token.count', -1 do + post '/logout' + end + assert cookies['custom_autologin'].blank? end end