Esempio n. 1
0
 /**
  * Authenticate controller action by login customer
  *
  * @param   Mage_Core_Controller_Varien_Action $action
  * @param   bool $loginUrl
  * @return  bool
  */
 public function authenticate(Mage_Core_Controller_Varien_Action $action, $loginUrl = null)
 {
     if ($this->isLoggedIn()) {
         return true;
     }
     $this->setBeforeAuthUrl(Mage::getUrl('*/*/*', array('_current' => true)));
     if (isset($loginUrl)) {
         $action->getResponse()->setRedirect($loginUrl);
     } else {
         $action->setRedirectWithCookieCheck(Mage_Customer_Helper_Data::ROUTE_ACCOUNT_LOGIN, Mage::helper('customer')->getLoginUrlParams());
     }
     return false;
 }