1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-01-09 09:01:31 +00:00

Localisation not set correctly on authenticity token errors (#18499).

Patch by Felix Schäfer.

git-svn-id: http://svn.redmine.org/redmine/trunk@13670 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2014-11-29 15:16:59 +00:00
parent 6fe38abdc7
commit 6f3ab71f3f
2 changed files with 12 additions and 0 deletions

View File

@ -45,6 +45,7 @@ class ApplicationController < ActionController::Base
super
cookies.delete(autologin_cookie_name)
self.logged_user = nil
set_localization
render_error :status => 422, :message => "Invalid form authenticity token."
end
end

View File

@ -76,4 +76,15 @@ class ApplicationTest < ActionDispatch::IntegrationTest
ensure
ActionController::Base.allow_forgery_protection = false
end
def test_localization_should_be_set_correctly_on_invalid_token
ActionController::Base.allow_forgery_protection = true
Setting.default_language = 'en'
post 'issues', { }, 'HTTP_ACCEPT_LANGUAGE' => 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3'
assert_response 422
assert_equal :fr, current_language
assert_select "html[lang=?]", "fr"
ensure
ActionController::Base.allow_forgery_protection = false
end
end