Page MenuHomePhabricator

Return to previous page after login via header
Closed, ResolvedPublic

Description

When we click the login link and are taken to the login page, after completing the login process we should be taken back to the page where we previously were, rather than the home page.

Event Timeline

waldyrious raised the priority of this task from to Needs Triage.
waldyrious updated the task description. (Show Details)
waldyrious added a project: Maniphest.
waldyrious added a subscriber: waldyrious.

Yes, it should do this. Can you give an example of where it doesn't?

If my test is correct, you are sent to the homepage after logging in, regardless of where you were before.

I don't recall where, but I have also seen this request in our Wikimedia instance. MediaWiki does leave you in the page you were before logging in, so this is the expectation there as well.

I think which link "the login link" is matters.

If you hit a page you need to login for, the login form appears directly on the page and works (you end up on that page logged in and not the home page.)

"The login link" maybe refers to the link in the upper right. I'd guess user scenarios are things like "not logged in yet and browsing the many public tasks and want to comment so click the login link..."

Can people hitting this elucidate as exactly as possible which link(s) they are clicking?

The login button in the header, yes.

chad renamed this task from Return to previous page after login to Return to previous page after login via header.Jan 5 2015, 11:12 PM
chad edited projects, added Auth; removed Maniphest.
chad triaged this task as Normal priority.Jan 5 2015, 11:18 PM

Seems reasonable to support this.

epriestley added a subscriber: epriestley.
  • In PhabricatorAuthApplication->buildMainMenuItems(), add ?next=<the current path> to the "Log In" item.

Something like this:

$uri = new PhutilURI('/auth/start/');
if ($controller) {
  $path = $controller->getRequest()->getPath();
  $uri->setQueryParam('next', $path);
}
// ...
->setHref($uri);
// ...

To test:

  • Enable policy.allow-public.
  • View some public object, like a task.
  • Click the login link.
  • After logging in, you should be taken back to the task page.