Commit 92dd2934 authored by Felix Schäfer's avatar Felix Schäfer

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

[#652] fixes wrong redirect after login 
parents 3cc95353 34dc06a8
......@@ -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"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment