Hi!

Problem/Motivation

User can't log in via one-time link that contains a "/login" suffix in the end.

Proposed resolution

I detected the problem that I can't log in via an one-time link (drush generated) after update of the Drupal core. After each attempt of login I'm redirected to a "user/password" page with a message "You have tried to use a one-time login link that has either been used or is no longer valid." I made an investigation and found that the problem is in Login Destination module - in "<current>" placeholder.

The Drupal 7.50 release contains an update in the login logic - #889772: Following a password reset link while logged in leaves users unable to change their password. This issue is a reason of the bug - so I think it's important to fix this bug at the Login Destination side.

Preconditions:

  • Drupal 7.50
  • Login Destination module 7.x-1.x
  • a simple Login Destination rule should be added:
    1. DESTINATION: "<current>"
    2. TRIGGERS: "Login"
    3. PAGES: "All pages"
    4. ROLES: "All roles"
    5. ENABLED: True

Let me try to explain what is a nature of the bug:

  • user uses one-time link
  • Drupal authenticate the user
  • Login Destination module set a current one-time link path as a 'destination' parameter via hook_user_login()
  • user goes again to the path that equal to an one-time link via drupaL_goto()
  • an updated core of Drupal logout the user and redirects again to the one-time link page
  • Drupal tries to authenticate the user but the one-link is already expired
  • user is redirected to the "user/password" page

In my opinion a "<current>" placeholder should be updated: it shouldn't return a current path for the "one-time login" menu callback.

The patch will be attached.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Chalk created an issue. See original summary.

Chalk’s picture

Issue summary: View changes
Chalk’s picture

Status: Active » Needs review
FileSize
452 bytes

Patch is here. Please, review it.

Chalk’s picture

Issue summary: View changes
jastraat’s picture

Status: Needs review » Reviewed & tested by the community

This fixed our issue with drush uli as well.

Chalk’s picture

Component: Documentation » Code
EternalLight’s picture

The patch is actually working. That's amazing! Thank you, Chalk!

ddrozdik’s picture

Assigned: Unassigned » ddrozdik

  • ddrozdik committed 73abbff on 7.x-1.x authored by Chalk
    Issue #2776655 by Chalk, jastraat, EternalLight, ddrozdik: Incorrect...
ddrozdik’s picture

Assigned: ddrozdik » Unassigned
Status: Reviewed & tested by the community » Fixed

Thank you, committed to dev branch.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.