В нашем приложении Magento мы использовали шаблон транзакционной электронной почты для отправки письма для сброса пароля.
Когда мы нажимаем кнопку submit
в окне забытого пароля, будет отправлено одно электронное письмо на основе шаблона электронной почты...
Ниже приведен код в 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);
Содержимое почты будет следующим:
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.
Так в чем же проблема?
Когда я щелкнул ссылку в почте, она загрузит ссылку о забытом пароле с сообщением об ошибке, в котором говорится:
Your password reset link has expired.