I am creating a customer from the code for a specific group code created a new record in the customer_entity
table but when I try to login from the website its shows invalid username or password
error while the customer created from the magento admin panel working fine and login to the website and redirect to the account page. check my code below:
public function editAction()
{
$oenologist = Mage::getModel('tandem_oenologistuser/oenologist');
if ($oenologistId = $this->getRequest()->getParam('id', false))
{
$oenologist->load($oenologistId);
}
if ($postData = $this->getRequest()->getPost('oenologistData'))
{
try {
$oenologist->addData($postData);
$oenologist->save();
if(!$this->getRequest()->getParam('id'))
{
$name = $postData['name'];
$email = $postData['email'];
$password = '1234567';
$groupId = 4;
$websiteIdVal = 1;
$websiteId = Mage::app()->getWebsite()->getId();
$store = Mage::app()->getStore();
$customer = Mage::getModel("customer/customer");
$customer->setWebsiteId($websiteIdVal)
->setStore($store)
->setFirstname($name)
->setEmail($email)
->setPassword($password)
->setGroupId($groupId)
->setIsActive(1);
try{
$customer->save();
}
catch (Exception $e) {
Zend_Debug::dump($e->getMessage());
}
}
$this->_getSession()->addSuccess(
$this->__('The oenologist has been saved.')
);
return $this->_redirect(
'tandem_oenologistuser_admin/oenologist/edit',
array('id' => $oenologist->getId())
);
} catch (Exception $e) {
Mage::logException($e);
$this->_getSession()->addError($e->getMessage());
}
}
Mage::register('current_oenologist', $oenologist);
$oenologistEditBlock = $this->getLayout()->createBlock(
'tandem_oenologistuser_adminhtml/oenologist_edit'
);
$this->loadLayout()
->_addContent($oenologistEditBlock)
->renderLayout();
}
Also, its add the website id to 0. I need to check the user on login for this specific group and redirect user to a custom controller action which is the user's custom profile page or is there any way i can customize the account page.
I have used the this link to create the users programmaticaly.