protected function getRedirectionUrl(Mage_Core_Controller_Varien_Action $controller)
 {
     $headers = $controller->getResponse()->getHeaders();
     $redirectLocation = "";
     foreach ($headers as $item) {
         if ($item['name'] == 'Location') {
             $redirectLocation = $item['value'];
         }
     }
     return $redirectLocation;
 }
Esempio n. 2
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;
 }
Esempio n. 3
0
 /**
  * Authenticate controller action by login customer
  *
  * @param   Mage_Core_Controller_Varien_Action $action
  * @return  bool
  */
 public function authenticate(Mage_Core_Controller_Varien_Action $action, $loginUrl = null)
 {
     if (!$this->isLoggedIn()) {
         $this->setBeforeAuthUrl(AO::getUrl('*/*/*', array('_current' => true)));
         if (is_null($loginUrl)) {
             $loginUrl = AO::helper('customer')->getLoginUrl();
         }
         $action->getResponse()->setRedirect($loginUrl);
         return false;
     }
     return true;
 }
 /**
  * @param Mage_Core_Controller_Varien_Action
  * @param Mage_Catalog_Model_Product
  */
 protected function redirectToProductUrl(Mage_Core_Controller_Varien_Action $controllerAction, Mage_Catalog_Model_Product $product)
 {
     $controllerAction->getResponse()->setRedirect($product->getProductUrl());
 }
Esempio n. 5
0
 /**
  * @magentoAppIsolation enabled
  */
 public function testNoCookiesAction()
 {
     $this->assertEmpty($this->_model->getResponse()->getBody());
     $this->_model->noCookiesAction();
     $this->assertNotEmpty($this->_model->getResponse()->getBody());
 }
Esempio n. 6
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->_getSession()->isLoggedIn()) {
         if ($action->getRequest()->isAjax()) {
             $this->_getSession()->setBeforeVendorAuthUrl(Mage::getUrl('*/vendor/', array('_current' => true, '_secure' => true, '_nosid' => true)));
         } else {
             $oAuthUrl = Mage::getUrl('*/*/*', array('_current' => true, '_secure' => true, '_nosid' => true));
             $this->_getSession()->setBeforeVendorAuthUrl($oAuthUrl);
         }
         if (is_null($loginUrl)) {
             if (Mage::getConfig()->getModuleConfig('Ced_CsVendorPanel')->is('active', 'true')) {
                 $url = 'csmarketplace/account/login';
             } else {
                 $url = 'customer/account/login';
             }
             $loginUrl = Mage::getUrl($url, array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure(), '_nosid' => true));
         }
         if ($action->getRequest()->isAjax()) {
             $ajaxResponse = array();
             $ajaxResponse['ajaxExpired'] = true;
             $ajaxResponse['ajaxRedirect'] = $loginUrl;
             $action->getResponse()->setBody(json_encode($ajaxResponse));
             return;
         }
         $action->getResponse()->setRedirect($loginUrl);
         return false;
     }
     if ($this->_getSession()->isLoggedIn() && Mage::helper('csmarketplace')->authenticate($this->_getSession()->getCustomerId())) {
         $vendor = Mage::getModel('csmarketplace/vendor')->loadByCustomerId($this->_getSession()->getCustomerId());
         if ($vendor && $vendor->getId()) {
             $this->_getSession()->setData('vendor_id', $vendor->getId());
             $this->_getSession()->setData('vendor', $vendor);
             Mage::dispatchEvent('ced_csmarketplace_vendor_authenticate_after', array('session' => $this->_getSession()));
         }
     }
     Mage::dispatchEvent('ced_csmarketplace_vendor_acl_check', array('current' => $this, 'action' => $action));
     return $this->_allowedResource;
 }
Esempio n. 7
0
 public function authenticate(Mage_Core_Controller_Varien_Action $action, $loginUrl = null)
 {
     if (!$this->isLoggedIn()) {
         $this->setBeforeAuthUrl(Mage::getUrl('*/*/*', array('_current' => true)));
         if (is_null($loginUrl)) {
             $loginUrl = Mage::getUrl('udropship/vendor/login');
         }
         $action->getResponse()->setRedirect($loginUrl);
         return false;
     }
     return true;
 }