Error Screenshot : https://i.imgur.com/SIAjq0C.png
<!--@subject {{trans "Reset your %store_name password" store_name=$store.frontend_name}} @-->
<!--@vars {
"var store.frontend_name":"Store Name",
"var customer.name":"Customer Name",
"var this.getUrl($store,'customer/account/createPassword/',[_query:[token:$customer.rp_token],_nosid:1])":"Reset Password URL"
} @-->
{{template config_path="design/email/header_template"}}
<p class="greeting">{{trans "%name," name=$customer.name}}</p>
<p>{{trans "There was recently a request to change the password for your account."}}</p>
<p>{{trans "If you requested this change, set a new password here:"}}</p>
<table class="button" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table class="inner-wrapper" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td align="center">
<a href="{{var this.getUrl($store,'customer/account/createPassword/',[_query:[token:$customer.rp_token],_nosid:1])}}" target="_blank">{{trans "Set a New Password"}}</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p>{{trans "If you did not make this request, you can ignore this email and your password will remain the same."}}</p>
{{template config_path="design/email/footer_template"}}
-
what's not working? The link in the email? At some point there was a change to the url that requires an update if you have customized the reset password templates. Will add as answer in case this is the problem you are facing– sdaughertyCommented Sep 28, 2023 at 18:12
-
i am using magento 2.4.3 in this version using this url: <a href="{{var this.getUrl($store,'customer/account/createPassword/',[_query:[token:$customer.rp_token],_nosid:1])}}" target="_blank">{{trans "Set a New Password"}}</a>– Keval ChauhanCommented Sep 29, 2023 at 4:03
-
looks like you're right. The id parameter wasn't added until 2.4.4. So what is not right about the url? Does it lead back to magento? is it broken?– sdaughertyCommented Sep 29, 2023 at 19:03
1 Answer
In one of the version updates, there were minor updates to the reset password emails that added an id
query parameter to the urls.
If you have made customized versions of the templates, they wouldn't automatically get these updates, so you would need to manually update them.
Below in the Password Reset URL var and in the html, an id:$customer.id
query parameter was added.
You may need to remove other password email templates too. In my case, without this new id
parameter, the password reset links in the emails didn't work correctly as the code uses the id
parameter now.
Full sample
<!--@subject {{trans "Reset your %store_name password" store_name=$store.frontend_name}} @-->
<!--@vars {
"var store.frontend_name":"Store Name",
"var customer.name":"Customer Name",
"var this.getUrl($store,'customer/account/createPassword/',[_query:[id:$customer.id,token:$customer.rp_token],_nosid:1])":"Reset Password URL"
} @-->
{{template config_path="design/email/header_template"}}
<p class="greeting">{{trans "%name," name=$customer.name}}</p>
<p>{{trans "There was recently a request to change the password for your account."}}</p>
<p>{{trans "If you requested this change, set a new password here:"}}</p>
<table class="button" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table class="inner-wrapper" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td align="center">
<a href="{{var this.getUrl($store,'customer/account/createPassword/',[_query:[id:$customer.id,token:$customer.rp_token],_nosid:1])}}" target="_blank">{{trans "Set a New Password"}}</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p>{{trans "If you did not make this request, you can ignore this email and your password will remain the same."}}</p>
{{template config_path="design/email/footer_template"}}