public function isConfirmationRequired() { if (self::$_isConfirmationRequired === null) { $storeId = $this->getStoreId() ? $this->getStoreId() : null; self::$_isConfirmationRequired = (bool) Mage::getStoreConfig(self::XML_PATH_IS_CONFIRM, $storeId); } return self::$_isConfirmationRequired; }
public function loadByEmail(Cminds_MultiUserAccounts_Model_SubAccount $subAccount, $email, $testOnly = false) { $adapter = $this->_getReadAdapter(); $bind = array('customer_email' => $email); $select = $adapter->select()->from($this->getMainTable(), array($this->getIdFieldName()))->where('email = :customer_email'); if ($subAccount->getSharingConfig()->isWebsiteScope()) { if (!$subAccount->hasData('website_id')) { Mage::throwException(Mage::helper('customer')->__('Sub Account website ID must be specified when using the website scope')); } $bind['website_id'] = (int) $subAccount->getWebsiteId(); $select->where('website_id = :website_id'); } $subAccountId = $adapter->fetchOne($select, $bind); if ($subAccountId) { $this->load($subAccount, $subAccountId); } else { $subAccount->setData(array()); } return $this; }
public function setSubAccount(Cminds_MultiUserAccounts_Model_SubAccount $subAccount) { // check if customer is not confirmed if ($subAccount->isConfirmationRequired()) { if ($subAccount->getConfirmation()) { return $this->_logout(); } } $this->_subAccount = $subAccount; $this->setSubAccountId($subAccount->getId()); // save customer as confirmed, if it is not ( remove confirmation key ) if (!$subAccount->isConfirmationRequired() && $subAccount->getConfirmation()) { $subAccount->setConfirmation(null)->save(); $subAccount->setIsJustConfirmed(true); } return $this; }
/** * Success Registration * * @param Mage_Customer_Model_Customer $customer * @return Mage_Customer_AccountController * * @TODO MAIL CONFIRMATION */ protected function _successProcessSubAccountRegistration(Cminds_MultiUserAccounts_Model_SubAccount $subAccount) { $session = $this->_getSession(); if ($subAccount->isConfirmationRequired()) { /** @var $app Mage_Core_Model_App */ $app = $this->_getApp(); /** @var $store Mage_Core_Model_Store */ $store = $app->getStore(); $subAccount->sendNewAccountEmail('confirmation', $session->getBeforeAuthUrl(), $store->getId()); $subAccountHelper = $this->_getHelper('cminds_multiuseraccounts'); $session->addSuccess($this->__('Account confirmation is required. Please, check your email for the confirmation link. To resend the confirmation email please <a href="%s">click here</a>.', $subAccountHelper->getEmailConfirmationUrl($subAccount->getEmail()))); } $session->addSuccess($this->__('New user created')); $url = $this->_getUrl('*/*/subAccount', array('_secure' => true)); $this->_redirectSuccess($url); return $this; }