magento got invalid login or password error for customer
-
13-12-2019 - |
Question
i added one customer programmatically and send mail to that customer for new password and also in admin side i found that customer but when customer try to login with email id and password got error 'Invalid login or password' here is my code what is problem with this?
define('MAGENTO_ROOT', getcwd());
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
require_once $mageFilename;
Mage::init();
Mage::setIsDeveloperMode(true);
ini_set('memory_limit', '-1'); //for unlimited memory being more trickey
ini_set('display_errors', 1);
Varien_Profiler::enable();
umask(0);
Mage::app('default');
$customer_email = 'test@testemail.com'; // email adress that will pass by the questionaire
$customer_fname = 'test_firstname'; // we can set a tempory firstname here
$customer_lname = 'test_lastname'; // we can set a tempory lastname here
$passwordLength = 10; // the lenght of autogenerated password
$customer = Mage::getModel('customer/customer');
$customer->setWebsiteId(Mage::app()->getWebsite()->getId());
$customer->loadByEmail($customer_email);
/*
* Check if the email exist on the system.
* If YES, it will not create a user account.
*/
if(!$customer->getId()) {
//setting data such as email, firstname, lastname, and password
$customer->setEmail($customer_email);
$customer->setFirstname($customer_fname);
$customer->setLastname($customer_lname);
$customer->setPassword($customer->generatePassword($passwordLength));
}
try{
//the save the data and send the new account email.
$customer->save();
$customer->setConfirmation(null);
$customer->save();
$customer->sendNewAccountEmail();
}
catch(Exception $ex){
}
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange