我想覆盖前端站点中Magento的忘记密码消息:
如果有与loremipsum@yahoo.com关联的帐户,您将收到一封电子邮件,其中包含重置密码的链接。
我想通过以下电子邮件验证来覆盖此邮件:
我是否在Magento默认消息中有替代解决方案并进行验证?
谢谢,
答案 0 :(得分:3)
你可以在
中找到Mage_Customer_AccountController
转到函数forgotPasswordPostAction()
并替换为此代码 **
您的情况从//自定义代码开始 **
开始 public function forgotPasswordPostAction()
{
$email = (string) $this->getRequest()->getPost('email');
if ($email) {
if (!Zend_Validate::is($email, 'EmailAddress')) {
$this->_getSession()->setForgottenEmail($email);
$this->_getSession()->addError($this->__('Invalid email address.'));
$this->_redirect('*/*/forgotpassword');
return;
}
/** @var $customer Mage_Customer_Model_Customer */
$customer = Mage::getModel('customer/customer')
->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
->loadByEmail($email);
if ($customer->getId()) {
try {
$newResetPasswordLinkToken = Mage::helper('customer')->generateResetPasswordLinkToken();
$customer->changeResetPasswordLinkToken($newResetPasswordLinkToken);
$customer->sendPasswordResetConfirmationEmail();
} catch (Exception $exception) {
$this->_getSession()->addError($exception->getMessage());
$this->_redirect('*/*/forgotpassword');
return;
}
}
else //custom code start
{
$this->_getSession()->addError(Mage::helper('customer')->__('Your email address %s does not exist.',Mage::helper('customer')->htmlEscape($email)));
$this->_redirect('*/*/');
return;
}//custom code end
$this->_getSession()
->addSuccess(Mage::helper('customer')->__('We have sent you a reset link in your email address %s .', Mage::helper('customer')->htmlEscape($email)));
$this->_redirect('*/*/');
return;
} else {
$this->_getSession()->addError($this->__('Please enter your email.'));
$this->_redirect('*/*/forgotpassword');
return;
}
}
之后您可以覆盖此
答案 1 :(得分:0)
转到以下课程
Mage_Customer_AccountController
并在此函数内部存在此消息
forgotPasswordPostAction()
你可以从上面的课程
覆盖这个功能