2015-07-02 2 views
0

Я добавил одного клиента программным путем и отправил письмо этому клиенту для нового пароля, а также на стороне администратора я нашел этого клиента, но когда клиент попытается войти в систему с идентификатором электронной почты, а пароль получил ошибку «Недействительный логин или пароль ' вот мой код что с этим связано?magento получил неверный логин или пароль для клиента

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 = '[email protected]'; // 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){ 

} 

Заранее спасибо ....

ответ

0

Я предполагаю, что это не автоматически устанавливая клиента к активным. Вы можете подтвердить, выполнив этот запрос на своем db;

SELECT * FROM customer_entity WHERE email = '[email protected]' 

Существует столбец, называемый 'is_active', почти наверняка установлен на 0 для нет.

В вашем скрипте для создания клиента добавьте это перед сохранением;

$customer->setIsActive(1); 
Смежные вопросы