magento2: Admin reset password link broken
Preconditions and environment
- Magento 2.4.4
- Multiple websites and stores
Steps to reproduce
- Enable settings Add Store Code to Urls
- Create 2 new website with each 1 store view
- Create new admin user
- Click
Forgot your password?link in the admin login page; - Input your e-mail and submit;
- Click the link in the email.
Expected result
Form to reset the password
Actual result
404 not found
Additional information
Link is generated as http://magento.local/admin/admin_123456/admin/auth/resetpassword/key/xxxxxxxxxx/?id=1&token=yyyyyyyy, but it should be http://magento.local/admin_123456/admin/auth/resetpassword/key/xxxxxxxxxx/?id=1&token=yyyyyyyy (notice the extra admin/ right after the domain name).
Release note
No response
Triage and priority
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 3
- Comments: 39 (14 by maintainers)
Based on @bruno-blackbird workaround, I’ve created another patch to avoid touch any other area. Already tested on v2.4.6
Above patch only add the flag to the specific function that trigger the email.
You can fix this issue without any patches also.
Just modify the one line from the vendor/magento/module-user/view/adminhtml/email/password_reset_confirmation.html email template,
From the Store URL, Remove admin from the store url="admin/auth/resetpassword
{{store url="admin/auth/resetpassword/" _query_id=$user.user_id _query_token=$user.rp_token _nosid=1}}Replace line no 23 with the given line,
{{store url="auth/resetpassword/" _query_id=$user.user_id _query_token=$user.rp_token _nosid=1}}Just create a new Forgot Admin Password template from the Backend, Marketing -> Communication -> Email Template Create a new template by clicking on the Add New Template button,
Now Load Default Template from the Magento_User -> Forgot Admin Password
After Loading, just modify the above line from the email template and save the new template.
Just Assigned this email template from the Stores -> Configuration -> Advanced -> Admin -> Admin User Emails,
From the Dropdown, Forgot Password Email Template you need to choose the template and Save Config.
Hi all, please find the official patch provided by support:
ACSD-48570_2.4.5.patch
We applied another workaround for this. It will solve all the cases where a store is passed directly to the url resolver.
we solved the same problem creating a plugin for Magento\User\Model\Notificator
with this workaround
Hi @kassner
Thanks for your contribution and collaboration. I have tried to reproduce the issue but in my case link is not broken I am successfully able to reset the password and able to login using new password. As you have observed extra
admin/in reset link same I also observed. Checked in Magento 2.4-develop and browser: Chrome & FireFox.Below is the screenshots for your reference:

Please provide more information if anything got missed and can be tested further.
Looks like that patch mentioned above got included in Magento 2.4.7: https://github.com/magento/magento2/commit/face8387fe48034d981d07efd45612ab2950f460
So I guess we can close this issue now?