Forgot password API
<?php
error_reporting(0);
ini_set("display_errors", 1);
$email = $_POST['email'];
require_once ('../app/Mage.php');
Mage::app();
$customer = Mage::getModel('customer/customer')
->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
->loadByEmail($email);
$return_array = array ();
if ($customer->getId()) {
try
{
$newResetPasswordLinkToken = Mage::helper('customer')->generateResetPasswordLinkToken();
$customer->changeResetPasswordLinkToken($newResetPasswordLinkToken);
$customer->setStoreId(Mage::app()->getStore()->getId());
$customer->sendPasswordResetConfirmationEmail();
$return_array['status'] = "1";
$return_array['message']="Password Reset Link Has Been Sent to Your Email Please Check, Your Mail Box!";
echo json_encode($return_array);
}
catch (Exception $exception)
{
Mage::log($exception);
}
}
else
{
$return_array['status'] = "0";
$return_array['message']="Please Enter a Valid Email!";
echo json_encode($return_array);
}
?>
No comments: