I am working on custom login using below code, before it was working fine now its giving error.
Error:
An uncaught Exception was encountered Type: Mage_Core_Model_Session_Exception Message: (null)
I don't know what caused this error. Please help me to fix this error
Thank you
<?php
function loginUser( $email, $password )
require_once ("app/Mage.php");
umask(0);
ob_start();
session_start();
Mage::app('default');
Mage::getSingleton("core/session", array("name" => "frontend"));
$websiteId = Mage::app()->getWebsite()->getId();
$store = Mage::app()->getStore();
$customer = Mage::getModel("customer/customer");
$customer->website_id = $websiteId;
$customer->setStore($store);
try {
$customer->loadByEmail($email);
$session = Mage::getSingleton('customer/session')->setCustomerAsLoggedIn($customer);
$session->login($email, $password);
}catch(Exception $e){
}
}
?>