Redirect to back_url or referer when clicking "Sign in" while already logged-in (#15926).

git-svn-id: http://svn.redmine.org/redmine/trunk@12705 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2014-01-25 12:35:05 +00:00
parent 5faa1a4e6e
commit a2f869b43e
3 changed files with 24 additions and 3 deletions

View File

@@ -373,7 +373,7 @@ class ApplicationController < ActionController::Base
url
end
def redirect_back_or_default(default)
def redirect_back_or_default(default, options={})
back_url = params[:back_url].to_s
if back_url.present?
begin
@@ -387,6 +387,9 @@ class ApplicationController < ActionController::Base
logger.warn("Could not redirect to invalid URL #{back_url}")
# redirect to default
end
elsif options[:referer]
redirect_to_referer_or default
return
end
redirect_to default
false