Ticket #2210 (new defect)

Opened 1 year ago

Last modified 1 month ago

After redirecting to the login screen, trac always loads the default page.

Reported by: jspencer@vpac.org Assigned to: coderanger
Priority: normal Component: PermRedirectPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.10

Description

If you follow a link (from an email for example) the login page comes up as expected, but after logging in the specific link is forgotten and you are taken to the default page (main wiki page).

I'm not sure if this is specifically a PermRedirectPlugin problem or a Trac problem in general, but it does affect RSS feeds quite a bit.

Attachments

permredirect.diff (2.5 kB) - added by garth@deadlybloodyserious.com on 03/28/08 12:46:20.
Proposed fix
PermRedirect-urlfix.diff (0.9 kB) - added by nathan@acceleration.net on 10/06/08 15:31:06.
Patch to the 0.11 branch to use the referer querystring parameter

Change History

11/30/07 20:53:01 changed by coderanger

This is due to how the HTTP referer header works with redirects. Unfortunately there isn't much I can do.

03/28/08 12:46:20 changed by garth@deadlybloodyserious.com

  • attachment permredirect.diff added.

Proposed fix

03/28/08 12:50:08 changed by garth@deadlybloodyserious.com

I've attached a patch for a fix. When you request a page and fail authentication, it sets a cookie to the URL you asked for. A wrapper around LoginModule._redirect_back adjusts the Referer header if it finds that cookie. _redirect_back then redirects back to the original page if authentication succeeds.

06/26/08 04:59:12 changed by anonymous

I couldn't get your patch file to apply to v0.11 of PermRedirectPlugin - I think the line numbering might be out?

(follow-up: ↓ 5 ) 06/26/08 05:10:07 changed by anonymous

Hmm... no, I think your patch must be for an earlier version.

(in reply to: ↑ 4 ) 06/26/08 05:16:10 changed by anonymous

Replying to anonymous:

Hmm... no, I think your patch must be for an earlier version.

It's a patch for 0.10 - you'll have to write your own patch for 0.11

09/22/08 16:52:24 changed by rblank

This could now be fixed by using the referer= argument to /login, added to Trac 0.11-stable in [T7493].

09/29/08 11:41:00 changed by bzhu@sitesell.com

Hi, Sir,

If you can provide a patch for 0.11 independently? We don't want to update the Trac, only want the the redirect problem fix. I searched but can't find the patch down. THanks in advance.

Bill

10/06/08 15:31:06 changed by nathan@acceleration.net

  • attachment PermRedirect-urlfix.diff added.

Patch to the 0.11 branch to use the referer querystring parameter

10/06/08 15:39:13 changed by nathan@acceleration.net

The patch I added above implements what rblank referred to in comment:6

10/06/08 15:54:55 changed by Bill

After implement the PermRedirect?-urlfix.diff , I got this. I am not developer, could you check what it is please?

Oops...

Trac detected an internal error: invalid syntax (filter.py, line 27)

Traceback (most recent call last):

File "/usr/lib/python2.4/site-packages/trac/admin/templates/deploy_trac.cgi", line 27, in ?

cgi_frontend.run()

File "/usr/lib/python2.4/site-packages/trac/web/cgi_frontend.py", line 71, in run

gateway.run(dispatch_request)

File "/usr/lib/python2.4/site-packages/trac/web/wsgi.py", line 87, in run

response = application(self.environ, self._start_response)

File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 381, in dispatch_request

env = open_environment(env_path, use_cache=not run_once)

File "/usr/lib/python2.4/site-packages/trac/env.py", line 571, in open_environment

env = Environment(env_path)

File "/usr/lib/python2.4/site-packages/trac/env.py", line 185, in init

load_components(self, plugins_dir and (plugins_dir,))

File "/usr/lib/python2.4/site-packages/trac/loader.py", line 108, in load_components

loadfunc(env, search_path, auto_enable=plugins_dir)

File "/usr/lib/python2.4/site-packages/trac/loader.py", line 65, in _load_eggs

entry.load(require=True)

File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 1912, in load

entry = import(self.module_name, globals(),globals(), __name__?)

File "/usr/lib/python2.4/site-packages/permredirect/filter.py", line 27

login_url = req.href.login(referer=req.base_url + req.path_info)

SyntaxError?: invalid syntax

10/06/08 16:00:45 changed by anonymous

I am using AccountManager, so can't load trac.web.auth LoginModule? in your first patch. If this will have problem for your new patch?

Bill

10/06/08 17:08:52 changed by anonymous

Replying to Bill :

After implement the PermRedirect?-urlfix.diff , I got this. I am not developer, could you check what it is please?

   File "/usr/lib/python2.4/site-packages/permredirect/filter.py", line 27
      login_url = req.href.login(referer=req.base_url + req.path_info)
      ^
  SyntaxError: invalid syntax

Not too sure here; the best I can suggest is to check the syntax in the resulting file, maybe the patch applied incorrectly? I inserted that line 27 ('login_url...') in the patch, make sure it is indented the same as the line above('exctype...') and below it('if...').

Replying to anonymous:

I am using AccountManager, so can't load trac.web.auth LoginModule? in your first patch. If this will have problem for your new patch? Bill

The two patches proposed here are entirely independent. If you have already applied attachment:permredirect.diff you should get a clean version(I have this one) of PermRedirectPlugin before applying attachment:PermRedirect-urlfix.diff. I don't reference LoginModule? anywhere in this code; other dependencies/incompatibilities I don't know anything about.

10/07/08 12:55:01 changed by Bill

I have rechecked the /usr/lib/python2.4/site-packages/permredirect/filter.py and sure it is same with your PermRedirect?-urlfix.diff.

Before when I search for this problem, I did see one patch for AccountManager plugin. But that patch was old and didn't work ( I tested by myself).

PermRedirect? plugin should fix this problem, that is why I installed it, but still have some problem. If anyone in your group and help to figure this out? Thanks anyway.

Bill


Add/Change #2210 (After redirecting to the login screen, trac always loads the default page.)




Change Properties
Action