Question

I want to Override the Forgot Password Message of Magento in Frontend sites:

  1. When I click Forgot Password in my frontend site, It says:

If there is an account associated with loremipsum@yahoo.com you will receive an email with a link to reset your password.

I want to override this message with an email validation of:

  1. Your email address loremipsum@yahoo.com does not exist, or
  2. We've sent you a reset link in your email address loremipsum@yahoo.com

Do I have an alternative solutions in Magento Default Message with validation?

Thanks,

Was it helpful?

Solution

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

OTHER TIPS

Go to following class

Mage_Customer_AccountController

and inside this function this message exist

 forgotPasswordPostAction()

you can OVERRIDE this function from above class

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top