/** * Check authentication * * Check customer authentication for some actions */ public function preDispatch() { parent::preDispatch(); $this->_session = Mage::getSingleton($this->_sessionName); if (!$this->_session->authenticate($this)) { $this->setFlag('', self::FLAG_NO_DISPATCH, true); } }
/** * Make sure customer is logged in and put it into registry */ public function preDispatch() { parent::preDispatch(); if (!$this->getRequest()->isDispatched()) { return; } $this->_session = Mage::getSingleton('customer/session'); if (!$this->_session->authenticate($this)) { $this->setFlag('', 'no-dispatch', true); } Mage::register('current_customer', $this->_session->getCustomer()); }
/** * Limit access to protected actions. */ public function preDispatch() { parent::preDispatch(); if (!$this->getRequest()->isDispatched()) { return; } $action = $this->getRequest()->getActionName(); $openActions = array('applyPlan'); $pattern = '/^(' . implode('|', $openActions) . ')/i'; $this->_session = Mage::getSingleton('customer/session'); if (!preg_match($pattern, $action)) { if (!$this->_session->authenticate($this)) { $this->setFlag('', 'no-dispatch', true); } Mage::register('current_customer', $this->_session->getCustomer()); } else { $this->_session->setNoReferer(true); } }