Feature #15926

Redirect to back_url or referer when clicking "Sign in" while already logged-in

Added by Daniel Seifert about 4 years ago. Updated about 4 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Accounts / authentication
Target version:2.5.0
Resolution:Fixed

Description

I subscribe to my activity view via activity.atom (using feedly). Links to e.g. wiki pages or commits are in the form https://my.site/redmine/login?back_url=https%3A%2F%2Fmy.site%2Fredmine%2Fprojects%2Fmyproject%2Frepository%2Frevisions%2F3hash

I work in the 2.4-stable branch, but looking at the code it seems that trunk has the same issue.

Bug:
When clicking on these links (or pasting them to the browser), accounts#login is executed. If I am already logged in, this executes redirect_to home_url (app/controllers/account_controller.rb:37) and I end up on the Redmine start page (/redmine). The back_url parameter is ignored.

Solution:

Index: app/controllers/account_controller.rb
===================================================================
--- app/controllers/account_controller.rb       (revision 12689)
+++ app/controllers/account_controller.rb       (working copy)
@@ -34,7 +34,7 @@
   def login
     if request.get?
       if User.current.logged?
-        redirect_to home_url
+        redirect_back_or_default home_url
       end
     else
       authenticate_user

Associated revisions

Revision 12705
Added by Jean-Philippe Lang about 4 years ago

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

History

#1 Updated by Jean-Philippe Lang about 4 years ago

  • Tracker changed from Patch to Feature
  • Subject changed from back_url ignored in accounts#login to Redirect to back_url or referer when clicking "Sign in" while already logged-in
  • Status changed from New to Closed
  • Assignee set to Jean-Philippe Lang
  • Target version set to 2.5.0
  • Resolution set to Fixed

Feature added in r12705.

Also available in: Atom PDF