/** * Set customer object and setting customer id in session * * @param Mage_Customer_Model_Customer $customer * @return Mage_Customer_Model_Session */ public function setCustomer(Mage_Customer_Model_Customer $customer) { // check if customer is not confirmed if ($customer->isConfirmationRequired()) { if ($customer->getConfirmation()) { throw new Exception('This customer is not confirmed and cannot log in.', Mage_Customer_Model_Customer::EXCEPTION_EMAIL_NOT_CONFIRMED); } } $this->_customer = $customer; $this->setId($customer->getId()); // save customer as confirmed, if it is not if (!$customer->isConfirmationRequired() && $customer->getConfirmation()) { $customer->setConfirmation(null)->save(); $customer->setIsJustConfirmed(true); } return $this; }
/** * Set customer object and setting customer id in session * * @param Mage_Customer_Model_Customer $customer * @return Mage_Customer_Model_Session */ public function setCustomer(Mage_Customer_Model_Customer $customer) { // check if customer is not confirmed if ($customer->isConfirmationRequired()) { if ($customer->getConfirmation()) { return $this->_logout(); } } $this->_customer = $customer; $this->setId($customer->getId()); // save customer as confirmed, if it is not if (!$customer->isConfirmationRequired() && $customer->getConfirmation()) { $customer->setConfirmation(null)->save(); $customer->setIsJustConfirmed(true); } return $this; }