プロジェクト

全般

プロフィール

Vote #63864

完了

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

Admin Redmine さんが4年以上前に追加. 4年以上前に更新.

ステータス:
Closed
優先度:
高め
担当者:
-
カテゴリ:
UI_10
対象バージョン:
開始日:
2008/09/15
期日:
進捗率:

0%

予定工数:
category_id:
10
version_id:
2
issue_org_id:
1900
author_id:
2123
assigned_to_id:
0
comments:
7
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

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

journals

* 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.
--------------------------------------------------------------------------------
Confirmed and fixed in r1890. Thanks for your patch.
--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------
A different fix is committed in r1905. Can you give it a try?
--------------------------------------------------------------------------------
Jean-Philippe Lang wrote:
> A different fix is committed in r1905. Can you give it a try?

r1905 works for me. Thanks for this!
--------------------------------------------------------------------------------
It works fine. Thanks.
--------------------------------------------------------------------------------
Thanks for the feedback.
--------------------------------------------------------------------------------

Admin Redmine さんが4年以上前に更新

  • カテゴリUI_10 にセット
  • 対象バージョン0.8_2 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0