Merge pull request #106 from finnlabs/pulls/652/fixes_redirect_containing_umlaute

[#652] fixes wrong redirect after login
pull/41/head
Felix Schäfer 13 years ago
commit 92dd2934ae
  1. 2
      app/controllers/application_controller.rb
  2. 9
      test/integration/account_test.rb

@ -262,7 +262,7 @@ class ApplicationController < ActionController::Base
end
def redirect_back_or_default(default)
back_url = CGI.unescape(params[:back_url].to_s)
back_url = URI.escape(CGI.unescape(params[:back_url].to_s))
if !back_url.blank?
begin
uri = URI.parse(back_url)

@ -32,6 +32,15 @@ class AccountTest < ActionController::IntegrationTest
assert_template "my/account"
end
def test_redirect_after_login
target_url = "/my/account?q=%C3%A4"
get target_url
post "/login", :username => 'jsmith', :password => 'jsmith', :back_url => @response.redirected_to[:back_url]
assert_redirected_to target_url
end
def test_autologin
user = User.find(1)
Setting.autologin = "7"

Loading…
Cancel
Save