Project

General

Profile

Actions

Defect #1900

closed

login filter providing incorrect back_url for Redmine installed in sub-directory

Added by Tony Kemp over 15 years ago. Updated over 15 years ago.

Status:
Closed
Priority:
High
Assignee:
-
Category:
UI
Target version:
Start date:
2008-09-15
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

I have Redmine running in a subdirectory on my server (i.e. in '/redmine'). The new require_login filter introduced a bug where the :back_url parameter that it creates does not take into account the relative URL root that this type of installation requires for redirection URLs. I have created a fix for this problem that works for both root installations and sub-directory installations, and I have included a patch below. This patch works for me, but you will want to do some testing to make sure I haven't broken anything.

This error is currently occurring in r1860, first noticed in r1802, though I think the bug was introduced earlier.
Rails: 2.1.0
Ruby: 1.8.6
Database: SQLite 3.4.2

Patch:

app/controllers/application.rb
@@ -81,7 +81,7 @@ class ApplicationController < ActionController::Base

   def require_login
     if !User.current.logged?
-      redirect_to :controller => "account", :action => "login", :back_url => request.request_uri
+      redirect_to :controller => "account", :action => "login", :back_url => request.relative_url_root + request.request_uri
       return false
     end
     true

Actions #1

Updated by Thomas Lecavelier over 15 years ago

  • Target version changed from 0.7.3 to 0.8
  • Maybe should be a patch, rather than a defect
  • Version 0.7.3 is already released, setting to 0.8 (btw: should be a 0.7.x version to gather patches which could be very cool for that branch)

Thank you for the patch! Hoping someone will try it.

Actions #2

Updated by Jean-Philippe Lang over 15 years ago

  • Status changed from New to Closed
  • Resolution set to Fixed

Confirmed and fixed in r1890. Thanks for your patch.

Actions #3

Updated by Go MAEDA over 15 years ago

  • Status changed from Closed to Reopened

After updated to r1890, I began to get incorrect back_url.

The Redmine is running in subdirectory(http://redmine.example.net/subdir/), and Redmine make incorrect back_url(back_url=back_url=%2Fsubdir%2Fsubdir%2F). Directory name appears twice.

Ruby 1.8.6
Rails 2.1.0
CentOS 5
Apache 2.2.3
Passenger 2.0.1

Actions #4

Updated by Jean-Philippe Lang over 15 years ago

A different fix is committed in r1905. Can you give it a try?

Actions #5

Updated by Tony Kemp over 15 years ago

Jean-Philippe Lang wrote:

A different fix is committed in r1905. Can you give it a try?

r1905 works for me. Thanks for this!

Actions #6

Updated by Go MAEDA over 15 years ago

It works fine. Thanks.

Actions #7

Updated by Jean-Philippe Lang over 15 years ago

  • Status changed from Reopened to Closed

Thanks for the feedback.

Actions

Also available in: Atom PDF