Project

General

Profile

Defect #18499 » 18499.patch

Felix Schäfer, 2014-11-29 14:03

View differences:

app/controllers/application_controller.rb
45 45
      super
46 46
      cookies.delete(autologin_cookie_name)
47 47
      self.logged_user = nil
48
      set_localization
48 49
      render_error :status => 422, :message => "Invalid form authenticity token."
49 50
    end
50 51
  end
test/integration/application_test.rb
76 76
  ensure
77 77
    ActionController::Base.allow_forgery_protection = false
78 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 90
end
    (1-1/1)