Modify

Opened 14 years ago

Closed 14 years ago

#8868 closed defect (fixed)

After login trac always redirects to default page loosing initial target

Reported by: anonymous Owned by: anatoly techtonik
Priority: normal Component: NoAnonymousPlugin
Severity: critical Keywords: redirect
Cc: s.major@… Trac Release: 0.12

Description

If user access a specified target, e.g. a wiki page or certain ticket and has to log-in in between, the target gets lost and user is redirected to the default page. It is similar to a problem described here for PermRedirectPlugin. Actually the solution proposed there (attachment:ticket:2210:PermRedirect-urlfix.2.diff) by simply replacing

req.redirect(req.href.login())

with

ref_url = req.base_url + req.path_info
if(req.query_string): ref_url = ref_url + "?" + req.query_string
login_url = req.href.login(referer=ref_url)
req.redirect(login_url)

also works for the NoAnonymousPlugin

Attachments (0)

Change History (5)

comment:1 Changed 14 years ago by anonymous

Cc: s.major@… added; anonymous removed

comment:2 Changed 14 years ago by anatoly techtonik

You might get an infinite loop if redirected to logout action.

comment:3 in reply to:  2 Changed 14 years ago by anonymous

Replying to techtonik: But it seems to happen only if you use the browser history. Usually I always land at the last visited place after relogin (provided the tab reminded open). Still you could check for referer ending with "logout" and replace with the base url.

comment:4 Changed 14 years ago by anatoly techtonik

Thanks for the patch. I've committed the change in r10369. Please, test that it works correctly.

comment:5 Changed 14 years ago by anatoly techtonik

Resolution: fixed
Status: newclosed

I've tested it myself and it works on 0.11.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain anatoly techtonik.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.