Kichu
Kichu

Reputation: 3267

Reset Password failed in magento

In our Magento application, we used a transactional email template to send a reset password mail.

When we click on the submit button in the forgot password window, one email will be sent, based on the email template...

The following is the code in Accountcontroller

$newResetPasswordLinkToken = Mage::helper('customer')->generateResetPasswordLinkToken();
                    /*$customer->changeResetPasswordLinkToken($newResetPasswordLinkToken);
                    $customer->sendPasswordResetConfirmationEmail();*/
                    $templateId = "Reset_password_user";
                    $flname = $customer->getFirstname().' '.$customer->getLastname();
                    $emailTemplate = Mage::getModel('core/email_template')->loadByCode($templateId);
                    $vars = array('name' => ucwords($flname), 'userid' => $customer->getId(), 'tocken' => $newResetPasswordLinkToken);
                    $emailTemplate->getProcessedTemplate($vars);
                    $storeId = Mage::app()->getStore()->getStoreId();
                    $emailTemplate->setSenderEmail(Mage::getStoreConfig('trans_email/ident_general/email', $storeId));
                    $emailTemplate->setSenderName(Mage::getStoreConfig('trans_email/ident_general/name', $storeId));
                    $emailTemplate->send($email,ucwords($flname), $vars);

The following will be the mail content:

There was recently a request to change the password for your account.
If you requested this password change, please click on the following link to reset your password: http://mywebsite.com/index.php/customer/account/resetpassword/?id=3607&token=f74609505166ef132345ba78539e6b90
If clicking the link does not work, please copy and paste the URL into your browser instead.

If you did not make this request, you can ignore this message and your password will remain the same.

So what is the problem here?

When i clicked on the link in the mail , it will load the forgot password link with an error message that says:

Your password reset link has expired.

Upvotes: 0

Views: 1920

Answers (2)

Yatin Khullar
Yatin Khullar

Reputation: 1590

I have same issue for me its problem with default mail template name: Forgot Password

In this template find below line

<a href="{{store url="customer/account/resetpassword/" _query_id=$customer.rp_customer_id _query_token=$customer.rp_token}}"><span>Reset Password</span></a>

and replace with below line:

<a href='{{store url="customer/account/resetpassword/" _query_id=$customer.id _query_token=$customer.rp_token}}'><span>Reset Password</span></a>

You will see issue with quotes only.

Hope this will help you.

Upvotes: 0

Munjal
Munjal

Reputation: 936

You should check for plugins that could be causing a conflict with this functionality, I too had a similar issue and removing unirgy gift certificate plugin helped the cause, also this could be not due to the plugin itself but not errors in configuring it.

Upvotes: 0

Related Questions