I want to Override the Forgot Password Message of Magento in Frontend sites:
If there is an account associated with [email protected] you will receive an email with a link to reset your password.
I want to override this message with an email validation of:
Do I have an alternative solutions in Magento Default Message with validation?
Thanks,
you can find this in
Mage_Customer_AccountController
and go to the function forgotPasswordPostAction()
and replace with this code **
your condition start with //custom code start**
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;
}
}
after that you can override this