I am trying to reset my password using below code,
$emailid = $this->post('email_id');
$customer = Mage::getModel('customer/customer')
->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
->loadByEmail($emailid);
if ($customer->getId()) {
try {
$newResetPasswordLinkToken = Mage::helper('customer')->generateResetPasswordLinkToken();
$customer->changeResetPasswordLinkToken($newResetPasswordLinkToken);
$customer->sendPasswordResetConfirmationEmail();
$this->response([
'status' => true,
'message' => 'Email sent successfully'
], REST_Controller::HTTP_OK); // NOT_FOUND (404) being the HTTP response code
}catch (Exception $exception) {
$this->response([
'status' => false,
'message' => 'Email ID is not registered with us.'
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
}
}
Above code it's working perfectly, I am getting mail also, But when I click reset password button in the mail, Its showing link expired.
I have noticed the password reset link, they have used two parameters (id, token). In the programmatically generated email, the link has only token, id parameter is missing. I don't know why id not coming.
Can any one help help me to fix this issue. Thanks.