##// END OF EJS Templates
Localisation not set correctly on authenticity token errors (#18499)....
Jean-Philippe Lang -
r13288:6f3ab71f3f4b
parent child
Show More
@@ -45,6 +45,7 class ApplicationController < ActionController::Base
45 super
45 super
46 cookies.delete(autologin_cookie_name)
46 cookies.delete(autologin_cookie_name)
47 self.logged_user = nil
47 self.logged_user = nil
48 set_localization
48 render_error :status => 422, :message => "Invalid form authenticity token."
49 render_error :status => 422, :message => "Invalid form authenticity token."
49 end
50 end
50 end
51 end
@@ -76,4 +76,15 class ApplicationTest < ActionDispatch::IntegrationTest
76 ensure
76 ensure
77 ActionController::Base.allow_forgery_protection = false
77 ActionController::Base.allow_forgery_protection = false
78 end
78 end
79
80 def test_localization_should_be_set_correctly_on_invalid_token
81 ActionController::Base.allow_forgery_protection = true
82 Setting.default_language = 'en'
83 post 'issues', { }, 'HTTP_ACCEPT_LANGUAGE' => 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3'
84 assert_response 422
85 assert_equal :fr, current_language
86 assert_select "html[lang=?]", "fr"
87 ensure
88 ActionController::Base.allow_forgery_protection = false
89 end
79 end
90 end
General Comments 0
You need to be logged in to leave comments. Login now