Modify

Opened 4 years ago

Closed 3 years ago

#8868 closed defect (fixed)

After login trac always redirects to default page loosing initial target

Reported by: anonymous Owned by: 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 4 years ago by anonymous

  • Cc s.major@… added; anonymous removed

comment:2 follow-up: Changed 4 years ago by techtonik

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

comment:3 in reply to: ↑ 2 Changed 4 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 3 years ago by techtonik

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

comment:5 Changed 3 years ago by techtonik

  • Resolution set to fixed
  • Status changed from new to closed

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

Add Comment

Modify Ticket

Action
as closed The owner will remain techtonik.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.