Closed (fixed)
Project:
Password Reset Landing Page (PRLP)
Version:
7.x-1.3
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
12 Apr 2021 at 12:35 UTC
Updated:
29 Nov 2021 at 19:45 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
uv516 commentedComment #3
isholgueras commentedI can confirm this is happening to me in a recently upgraded Drupal 7.79.
One of the things introduced in 7.79 is in user.pages.inc:148, a new session variable named
$_SESSION['pass_reset_hash']And later is used to check whether the reset call is valid or not:
For some reason,
$_SESSIONis empty when prlp is enabled but has the right value if the module prlp is disabled.Comment #4
isholgueras commentedHi all,
I think I found the root issue.
In Drupal 7.79, due to this issue: https://www.drupal.org/node/3205476, a new change in
user.pages.inc:251was introduced.The problem comes when in
prlp_form_user_pass_reset_alterwe are executingunset($form['#action']);, so we're deleting the action Drupal is inserting. This causes to not even enter in the login action indeed:If I remove the code of unsetting the form #action, the user is now able to log in, but the password change is not applied.
Comment #5
isholgueras commentedI was able to fix the issue, but we need a change in Drupal core. Here is the ticket and patch: https://www.drupal.org/project/drupal/issues/3208600
And here is also the patch I've created. Maybe is not very clean and there is another better approach, but after the Drupal 7.79 changes, the
$hashed_passdoes no longer come in the form action, so I had to save it in session.Applying both patches fixes the issue with the login, but I would like to know from the Drupal core team if I'm missing something with the change in drupal core.
Comment #6
steveganz commentedComment #7
mistergroove commentedPatch doesn't work for me. Thought it might be a result of require_login module too but disabling this still results in the same behaviour:
Password reset link clicked
Reset password form works normally but submitting it takes you to the forgotten password page with the following message:
"You have tried to use a one-time login link that has either been used or is no longer valid. Please request a new one using the form below." every time.
Password is not changed.
Comment #8
steveganz commented@mistergroove, did you also apply the patch in https://www.drupal.org/project/drupal/issues/3208600#comment-14058941?
Comment #9
mistergroove commentedThanks @steveganz and @isholgueras. I overlooked that patch. Works fine now.
I've added a note in the drupal 7.79 Change records for "Password reset confirmation form changes" to hopefully direct anyone else having a simular issue.
https://www.drupal.org/node/3205476#comment-14060024
Hope that was in the right place.
Thanks again.
Comment #10
loze commentedApplying both patches got this working correctly for me. Thanks!
Comment #11
sveldkamp commentedApplying both patches fixed the issue for me as well. Thank you!
Comment #12
eogiles commentedThis patch and the one from the other issue seem to resolve the issue. However I did not make the first change from this patch, from lines 19-27 and do not understand the purpose of it. It appears to be adding a menu item for the user reset URL which will display the admin configuration screen? That seems odd. Am I misunderstanding, or is that a mistake?
Comment #13
roderikNew patch:
I guess this change wasn't necessary - we could keep populating $_SESSION['plrp_reset_hash'] from $form['#action']. This new patch doesn't populate $_SESSION['plrp_reset_hash'] on older Drupal versions, which I guess is a small advantage...)
Comment #14
roderikHere's the actual patch :)
Comment #15
izmeez commentedUpdated issue title to be more explicit.
Comment #16
loze commentedPatch in #14 works and does not require the core patch. This is a better solution. +1
Comment #17
nullkernel commentedPatch #14 worked for me (after editing the prlp.module file's path in the diff). In addition to fixing password resets, it also fixed "drush user-login <username>".
I'm not sure if the "drush user-login <username>" problem happens on sites that don't have PRLP enabled. If it does, Drupal core might be the ideal place to fix this.
Comment #18
tomtech commentedAs noted by @nullkernel, the patch in #3208362-14: One-time login not working with drupal 7.79 doesn't apply cleanly, as it presumes a specific project root, rather than the module root.
Attached is a re-roll done at the module root.
Comment #19
simgui8 commented#18 fixes the problem for me (tested on Drupal 7.80).
Thanks everyone!
Comment #20
jurgenhaasWorks great, thanks for the patch. RTBC
Comment #21
puddyglum#18 kind of fixes the problem, but we're getting an error after choosing the new password:
This only happens once. Subsequent attempts appear to be fine. We have replicated the error three times with different users, both in dev and prod environments.
Comment #22
puddyglumThis error may be unrelated to this module. We are not seeing this error on a fresh install of Drupal 7.80 with only PRLP installed patch #18.
These are the steps that recreate the issue every time in our current live site.
We disabled LoginToboggan and still see this error, so we're still hunting it down. Don't want our issue impact the release of this fix. Thought I would share in case others are experiencing this issue.
Comment #23
puddyglumTo resolve the SQL error for our site we needed to remove user_login_finalize() from prlp_user_pass_reset_submit(). We tested to make sure that the password reset link was still invalidated and could not be used a second time.
** Update: Removing user_login_finalize() had other consequences such as Access Denied to the destination after the user changes their via PRLP. We've spent enough time on this and have chosen to switch to Simple Password Reset to avoid this scenario entirely.
Comment #24
daveianoPatch from #18 works for me. The core patch is not needed.
Comment #25
jitesh doshi commentedHi, this is the project maintainer. @TomTech (or anyone else), can you explain why we have a situation where we can't find the hash and give out a message "Could not find password hash; login will likely fail"? Why and under what circumstances we would have such variant and unpredictable behavior?
Comment #26
rjenkins commentedPatch from #18 worked for me on D7.80. Thanks!
Comment #27
tomtech commentedHI @jitesh-doshi. I'll defer to @roderik for a definitive answer, as the patch I provided in #18 was simply a re-roll of his patch.
The code that would produce that message seems to be defensive programming to handle an edge case.
It would probably make more sense if it either:
1. Wrote to watchdog instead.
2. Displayed a more user friendly message, rather than this debugging type of message.
I can observe that I've been using this in production for 2+ weeks now, so would also echo RTBC.
Comment #29
jitesh doshi commentedPatch incorporated into the repo and official release created 7.x-1.4. Thank you everyone who contributed!
Comment #30
mistergroove commentedNice one guys. Thanks.
Comment #31
roderikThank you. In answer to #25:
I know of no such case; TomTech is right that it was just defensive programming - because it feels like the presence of $_SESSION can be influenced by 'whatever' outside forces. Actually... the report in #3208600-11: Newly introduced $_SESSION['pass_reset_hash'] doesn't allow to alter user_pass_reset form looks like it could encounter this situation.
Whether just a watchdog log or a better message is needed, I leave up to the module maintainers. (I don't know of a useful message to display here, so it becomes a question of: do you want the user to see something in this case, so they can report something more than "login doesn't work"?)
Comment #33
loze commentedI am also getting the Integrity constraint violation error as described in #21 and #22 after setting the password using plrp 7.x-1.4 and drupal 7.81
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'at1ET7ri9-E6WVJMq5Q_kAI4QmR9CmlnHl_bIcpyYDU-czMwLmGzHmpStbEJyyqX' for key 'PRIMARY': UPDATE {sessions} SET sid=:db_update_placeholder_0, ssid=:db_update_placeholder_1 WHERE (ssid = :db_condition_placeholder_0) ; Array ( [:db_update_placeholder_0] => at1ET7ri9-E6WVJMq5Q_kAI4QmR9CmlnHl_bIcpyYDU [:db_update_placeholder_1] => czMwLmGzHmpStbEJyyqX1xvpPpkuKldJmcc0Kre1I7M [:db_condition_placeholder_0] => 5xseHqSPtEM6zFX1odylzGrLgOWMjMJMoqxlVeAtF-c ) in drupal_session_regenerate() (line 431 of C:\www\fstoppers\includes\session.inc).
Comment #34
q11q11 commentedDrupal 7.80 + patch #2 from drupal.org/project/drupal/issues/3208600 + PRLP 7.x-1.4 = I'm still having
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ... for key 'PRIMARY': UPDATE {sessions} ... in drupal_session_regenerate() (line 431 of ... /includes/session.inc)
Comment #35
nortmas commentedThe same issue for me - "PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry...."
Any Ideas?