Project

General

Profile

Actions

Defect #1900

closed

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

Added by Tony Kemp about 16 years ago. Updated about 16 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

Also available in: Atom PDF