Freshly created and active user, after redirection to user cabinet logged out instantly:
$this->_session = Mage::getSingleton('customer/session');
$session = $this->_session;
$customer = Mage::getModel('customer/customer')->setEmail($email)
->save();
// ^^^ successfully saves the customer entity
$session->setCustomerAsLoggedIn($customer);
// autoconfirm user
if($customer->getConfirmation()!=null){
$customer->setConfirmation(null);
}
if($session->isLoggedIn()) {
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getBaseUrl().'customer/account/');
return;
}
it successfully redirects and shows the user cabinet and 'Log out' link is active, but if I open the magento front page in other tab of same browser it becomes clearly that customer is not logged in. Where to debug ? Thanks!
UPDATE
I am trying to login freshly created customer without password. Password attribute set to 'required'=>false in customer entity, via install script.
UPDATE 2
I was also forgot to $customer->save(); after $customer->setConfirmation(null); it is mandatory