magento got invalid login or password error for customer -
i added 1 customer programmatically , send mail customer new password , in admin side found customer when customer try login email id , password got error 'invalid login or password' here code problem 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 pass questionaire $customer_fname = 'test_firstname'; // can set tempory firstname here $customer_lname = 'test_lastname'; // can set tempory lastname here $passwordlength = 10; // lenght of autogenerated password $customer = mage::getmodel('customer/customer'); $customer->setwebsiteid(mage::app()->getwebsite()->getid()); $customer->loadbyemail($customer_email); /* * check if email exist on system. * if yes, not create user account. */ if(!$customer->getid()) { //setting data such email, firstname, lastname, , password $customer->setemail($customer_email); $customer->setfirstname($customer_fname); $customer->setlastname($customer_lname); $customer->setpassword($customer->generatepassword($passwordlength)); } try{ //the save data , send new account email. $customer->save(); $customer->setconfirmation(null); $customer->save(); $customer->sendnewaccountemail(); } catch(exception $ex){ }
advance thanks....
i guess it's not automatically setting customer active. can confirm running query on db;
select * customer_entity email = 'the@email.com'
there column in there called 'is_active', set 0 no.
in script create customer add before save;
$customer->setisactive(1);
Comments
Post a Comment