Ejemplo n.º 1
0
 /**
  * Check customer authentication for some actions
  *
  * @param RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function execute(RequestInterface $request)
 {
     if (!$this->_customerSession->authenticate()) {
         $this->_actionFlag->set('', 'no-dispatch', true);
     }
     return parent::execute($request);
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function execute(\Magento\Framework\App\RequestInterface $request)
 {
     if (!$this->_getCheckout()->getCustomer()->getId()) {
         return $this->_redirect('customer/account/login');
     }
     return parent::execute($request);
 }
Ejemplo n.º 3
0
 /**
  * Check customer authentication for some actions
  *
  * @param \Magento\Framework\App\RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function execute(RequestInterface $request)
 {
     if (!$this->customerSession->authenticate()) {
         $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true);
     }
     return parent::execute($request);
 }
Ejemplo n.º 4
0
 /**
  * Dispatch request
  *
  * @param RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  * @throws \Magento\Framework\Exception\NotFoundException
  */
 public function execute(RequestInterface $request)
 {
     if (!$this->scopeConfig->isSetFlag(self::XML_PATH_ENABLED, ScopeInterface::SCOPE_STORE)) {
         throw new NotFoundException(__('Page not found.'));
     }
     return parent::execute($request);
 }
Ejemplo n.º 5
0
 /**
  * Check customer authentication
  *
  * @param RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function execute(RequestInterface $request)
 {
     $loginUrl = $this->_objectManager->get('Magento\\Customer\\Model\\Url')->getLoginUrl();
     if (!$this->_customerSession->authenticate($loginUrl)) {
         $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true);
     }
     return parent::execute($request);
 }
Ejemplo n.º 6
0
 /**
  * Check customer authentication
  *
  * @param RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function execute(RequestInterface $request)
 {
     if (!$request->isDispatched()) {
         return parent::execute($request);
     }
     if (!$this->_getSession()->authenticate()) {
         $this->_actionFlag->set('', 'no-dispatch', true);
     }
     return parent::execute($request);
 }
Ejemplo n.º 7
0
 /**
  * Check customer authentication for some actions
  *
  * @param \Magento\Framework\App\RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function execute(RequestInterface $request)
 {
     if (!$this->customerSession->authenticate()) {
         $this->_actionFlag->set('', 'no-dispatch', true);
         if (!$this->customerSession->getBeforeUrl()) {
             $this->customerSession->setBeforeUrl($this->_redirect->getRefererUrl());
         }
     }
     return parent::execute($request);
 }
Ejemplo n.º 8
0
 /**
  * Check whether payment method is enabled
  *
  * @param RequestInterface $request
  * @return \Magento\Framework\Controller\Result\Redirect|\Magento\Framework\App\ResponseInterface
  */
 public function execute(RequestInterface $request)
 {
     if (!$this->braintreePayPalConfig->isActive() || !$this->braintreePayPalConfig->isShortcutCheckoutEnabled()) {
         $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true);
         /** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
         $resultRedirect = $this->resultRedirectFactory->create();
         $resultRedirect->setPath('noRoute');
         return $resultRedirect;
     }
     return parent::execute($request);
 }
Ejemplo n.º 9
0
 /**
  * Dispatch request
  *
  * @param \Magento\Framework\App\RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function execute(RequestInterface $request)
 {
     $searchTerms = $this->scopeConfig->getValue(
         'catalog/seo/search_terms',
         ScopeInterface::SCOPE_STORE
     );
     if (!$searchTerms) {
         $this->_redirect('noroute');
         $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true);
     }
     return parent::execute($request);
 }
Ejemplo n.º 10
0
 /**
  * Check customer authentication
  *
  * @param RequestInterface $request
  * @return \Magento\Framework\Controller\Result\Redirect|\Magento\Framework\App\ResponseInterface
  */
 public function execute(RequestInterface $request)
 {
     $loginUrl = $this->customerUrl->getLoginUrl();
     if (!$this->customerSession->authenticate($loginUrl)) {
         $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true);
     }
     if (!$this->config->useVault()) {
         $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true);
         /** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
         $resultRedirect = $this->resultRedirectFactory->create();
         $resultRedirect->setPath('noRoute');
         return $resultRedirect;
     }
     return parent::execute($request);
 }
Ejemplo n.º 11
0
 public function testExecute()
 {
     // Define test expectations
     $this->resultPageFactory->expects($this->once())->method('create')->willReturn($this->page);
     $this->assertSame($this->page, $this->controller->execute());
 }
Ejemplo n.º 12
0
 /**
  * @param \Magento\Framework\App\RequestInterface $request
  * @return \Magento\Framework\App\ResponseInterface
  */
 public function execute(\Magento\Framework\App\RequestInterface $request)
 {
     if (!$this->_processUrlKeys()) {
         return parent::execute($request);
     }
     if ($request->isDispatched() && $request->getActionName() !== 'denied' && !$this->_isAllowed()) {
         $this->_response->setStatusHeader(403, '1.1', 'Forbidden');
         if (!$this->_auth->isLoggedIn()) {
             return $this->_redirect('*/auth/login');
         }
         $this->_view->loadLayout(['default', 'adminhtml_denied'], true, true, false);
         $this->_view->renderLayout();
         $this->_request->setDispatched(true);
         return $this->_response;
     }
     if ($this->_isUrlChecked()) {
         $this->_actionFlag->set('', self::FLAG_IS_URLS_CHECKED, true);
     }
     $this->_processLocaleSettings();
     return parent::execute($request);
 }
Ejemplo n.º 13
0
 public function execute()
 {
     //        echo "ONE";
     //        exit;
     parent::execute();
 }
Ejemplo n.º 14
0
    /**
     * Dispatch request
     *
     * @param RequestInterface $request
     * @return \Magento\Framework\App\ResponseInterface
     */
    public function execute(RequestInterface $request)
    {
        $allowGuest = $this->_objectManager->get('Magento\Review\Helper\Data')->getIsGuestAllowToWrite();
        if (!$request->isDispatched()) {
            return parent::execute($request);
        }

        if (!$allowGuest && $request->getActionName() == 'post' && $request->isPost()) {
            if (!$this->customerSession->isLoggedIn()) {
                $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true);
                $this->customerSession->setBeforeAuthUrl($this->_url->getUrl('*/*/*', ['_current' => true]));
                $this->_reviewSession->setFormData(
                    $request->getPostValue()
                )->setRedirectUrl(
                    $this->_redirect->getRefererUrl()
                );
                $this->getResponse()->setRedirect(
                    $this->_objectManager->get('Magento\Customer\Model\Url')->getLoginUrl()
                );
            }
        }

        return parent::execute($request);
    }
Ejemplo n.º 15
0
    /**
     * Check if module is enabled
     * If allow only for customer - redirect to login page
     *
     * @param RequestInterface $request
     * @return \Magento\Framework\App\ResponseInterface
     * @throws \Magento\Framework\Exception\NotFoundException
     */
    public function execute(RequestInterface $request)
    {
        /* @var $helper \Magento\SendFriend\Helper\Data */
        $helper = $this->_objectManager->get('Magento\SendFriend\Helper\Data');
        /* @var $session \Magento\Customer\Model\Session */
        $session = $this->_objectManager->get('Magento\Customer\Model\Session');

        if (!$helper->isEnabled()) {
            throw new NotFoundException(__('Page not found.'));
        }

        if (!$helper->isAllowForGuest() && !$session->authenticate()) {
            $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true);
            if ($this->getRequest()->getActionName() == 'sendemail') {
                $session->setBeforeAuthUrl($this->_url->getUrl('sendfriend/product/send', ['_current' => true]));
                $this->_objectManager->get('Magento\Catalog\Model\Session')
                    ->setSendfriendFormData($request->getPostValue());
            }
        }
        return parent::execute($request);
    }