fix protocol-relative redirection test

- escape forward slash in regexp
- allow redirection to home_path '/'
pull/1541/head
Philipp Tessenow 11 years ago committed by Christian Ratz
parent 1db8642ac6
commit 0cdbaf39f6
  1. 2
      app/controllers/application_controller.rb

@ -428,7 +428,7 @@ class ApplicationController < ActionController::Base
begin
uri = URI.parse(back_url)
# do not redirect user to another host or to the login or register page
if ((uri.relative? && back_url.match(%r{\A/\w})) || (uri.host == request.host)) && !uri.path.match(%r{/(login|account/register)})
if ((uri.relative? && !back_url.match(%r{\A\/\/})) || (uri.host == request.host)) && !uri.path.match(%r{/(login|account/register)})
redirect_to(back_url)
return
end

Loading…
Cancel
Save