I have the code:
function loginUser( $email, $password )
{
/** @var $session Mage_Customer_Model_Session */
$session = Mage::getSingleton( 'customer/session' );
try
{
$session->login( $email, $password );
$session->setCustomerAsLoggedIn( $session->getCustomer() );
return 1;
}
catch( Exception $e )
{
return $e;
}
}
$test = loginUser("login","password");
echo "test";
print_r($test);
die;
but I always get
Mage_Core_Exception Object ( [_messages:protected] => Array ( ) [message:protected] => Invalid login or password.
Login and password is correct, I tried many accounts, with the same result.
How can I log in correctly?