Problem/Motivation
The end user experience when needing to reset a password is confusing.
Steps to reproduce
- User lands on a page that is not the homepage, but needs to then login.
- User clicks a Login link. A destination parameter on the login link serves to return them to their place after login.
- However, the user forgets their password so clicks "Reset your Password" tab from Login page.
- Destination parameter is lost.
- User submits the password reset form and is redirected to the homepage, completely out of their browsing context.
- The password reset confirmation message feels out of place on the homepage and may be lost in a sea of unrelated marketing content.
- The one-time login link sent by email does not contain the original destination parameter, because it was lost from the URL context by the time they got to the password reset form in a previous step above.
Proposed resolution
- Preserve the destination parameter from URL to the "Reset Your Password" tab/link, particularly from the "Login" page.
- Pass along the destination parameter inside the one-time password login links sent by email to drop people back into the context they were in when they requested the login form and instead had to go reset their password.
- If no destination parameter is present, change the current redirect behavior to reload the current /user/password page instead of redirecting to the homepage.
- Add a way to change the default fallback redirect destination for password reset, instead of hardcoding an opinionated redirect destination and intercepting it via a form alter and submit handler as suggested in #3 and #9.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Original report by @prathamesh.save
How can I redirect some users after they reset their password? Specifically when user receives their password reset link, once they update their password after that they should be redirect to other pages. Simple login redirection can be done using hook_user_login(). But this wont work with user password reset.
Example: Redirect specific users based on their tags to some specific pages like:
user 1 will redirect to homepage-1
user 2 will redirect to homepage-2
Comments
Comment #2
cilefen commentedComment #3
shailja179 commented@prathamesh.save,
You can try something like below code to achieve this.
Comment #4
shailja179 commentedComment #5
smustgrave commented@prathamesh.save this answer your question?
Comment #6
prathamesh.save commentedThanks @shailja179 in normal behavior it worked.
@smustgrave yes, I got the answer thanks.
Comment #7
smustgrave commentedAwesome!
Comment #8
jwilson3I'm reopening this and classifying it as a feature request.
It does seem less than ideal that Drupal redirects the user to the homepage (and thus completely out of a user's login workflow and context).
More often than not, the homepage is filled with designy marketing blocks and highlighted regions. Occasionally these highlight/feature/hero theme regions can bump the system messages down below the fold. Long story short, the little password reset message can easily get lost in a sea of other more important content on the homepage.
The little password reset message:
This message feels totally out of place on a website's homepage.
On the other hand, the /user/login or /user/password page are typically fairly sparse aside from the form. On these pages the password reset message is not only relevant, but will be impossible to miss.
What Drupal *could* do to improve the UX on password reset:
Comment #9
jwilson3To get #3 working on Drupal 9/10+ try this:
Comment #10
jwilson3Comment #11
jwilson3Comment #12
jwilson3Comment #13
hockey2112 commented#9 worked great, thanks!
Comment #14
anybodyUpdating the title to be more specifc. Hope this one matches.