/** * {@inheritdoc} */ public function dispatch(\Magento\Framework\App\RequestInterface $request) { if (!$this->_getCheckout()->getCustomer()->getId()) { return $this->_redirect('customer/account/login'); } return parent::dispatch($request); }
/** * Dispatch request * * @param RequestInterface $request * @return ResponseInterface * @throws NotFoundException */ public function dispatch(RequestInterface $request) { if (!$this->customerSession->authenticate()) { $this->_actionFlag->set('', 'no-dispatch', true); } return parent::dispatch($request); }
/** * Dispatch request * * @param RequestInterface $request * @return \Magento\Framework\App\ResponseInterface * @throws \Magento\Framework\Exception\NotFoundException */ public function dispatch(RequestInterface $request) { if (!$this->scopeConfig->isSetFlag(self::XML_PATH_ENABLED, ScopeInterface::SCOPE_STORE)) { throw new NotFoundException(__('Page not found.')); } return parent::dispatch($request); }
/** * @param \Magento\Framework\App\RequestInterface $request * @return \Magento\Framework\App\ResponseInterface */ public function dispatch(\Magento\Framework\App\RequestInterface $request) { if (!$this->_isAllowed()) { throw new NotFoundException(__('Page not found.')); } return parent::dispatch($request); }
/** * Check customer authentication for some actions * * @param \Magento\Framework\App\RequestInterface $request * @return \Magento\Framework\App\ResponseInterface */ public function dispatch(RequestInterface $request) { if (!$this->customerSession->authenticate()) { $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true); } return parent::dispatch($request); }
/** * Dispatch request * * @param RequestInterface $request * @return \Magento\Framework\App\ResponseInterface */ public function dispatch(RequestInterface $request) { if (!$this->getRequest()->isDispatched()) { parent::dispatch($request); } $result = parent::dispatch($request); return $result; }
/** * Check customer authentication * * @param RequestInterface $request * @return \Magento\Framework\App\ResponseInterface */ public function dispatch(RequestInterface $request) { $loginUrl = $this->_objectManager->get('Magento\\Customer\\Model\\Url')->getLoginUrl(); if (!$this->_customerSession->authenticate($this, $loginUrl)) { $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true); } return parent::dispatch($request); }
/** * Dispatch request * * @param RequestInterface $request * @return ResponseInterface */ public function dispatch(RequestInterface $request) { $searchTerms = $this->scopeConfig->getValue('catalog/seo/search_terms', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); if (!$searchTerms) { $this->_redirect('noroute'); $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true); } return parent::dispatch($request); }
/** * Check customer authentication * * @param RequestInterface $request * @return \Magento\Framework\App\ResponseInterface */ public function dispatch(RequestInterface $request) { if (!$request->isDispatched()) { return parent::dispatch($request); } if (!$this->_getSession()->authenticate($this)) { $this->_actionFlag->set('', 'no-dispatch', true); } return parent::dispatch($request); }
/** * Dispatch request * * @param RequestInterface $request * @return \Magento\Framework\App\ResponseInterface */ public function dispatch(RequestInterface $request) { // Check this module is enabled in frontend if ($this->_dataHelper->isEnabledInFrontend()) { $result = parent::dispatch($request); return $result; } else { $this->_forward('noroute'); } }
/** * Check customer authentication for some actions * * @param \Magento\Framework\App\RequestInterface $request * @return \Magento\Framework\App\ResponseInterface */ public function dispatch(RequestInterface $request) { if (!$this->customerSession->authenticate()) { $this->_actionFlag->set('', 'no-dispatch', true); if (!$this->customerSession->getBeforeUrl()) { $this->customerSession->setBeforeUrl($this->_redirect->getRefererUrl()); } } return parent::dispatch($request); }
public function dispatch(RequestInterface $request) { if (!$this->session->isLoggedIn()) { return $this->_redirect('customer/account/login'); } if (!$this->config->isEnabled()) { return $this->_redirect($this->_redirect->getRefererUrl()); } return parent::dispatch($request); }
/** * Check whether payment method is enabled * * @param RequestInterface $request * @return \Magento\Framework\Controller\Result\Redirect|\Magento\Framework\App\ResponseInterface */ public function dispatch(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::dispatch($request); }
/** * Check whether payment method is enabled * * @inheritdoc */ public function dispatch(RequestInterface $request) { if (!$this->config->isActive() || !$this->config->isDisplayShoppingCart()) { $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true); /** @var Redirect $resultRedirect */ $resultRedirect = $this->resultRedirectFactory->create(); $resultRedirect->setPath('noRoute'); return $resultRedirect; } return parent::dispatch($request); }
/** * Make sure customer is logged in and put it into registry * * @param RequestInterface $request * @return \Magento\Framework\App\ResponseInterface */ public function dispatch(RequestInterface $request) { if (!$request->isDispatched()) { return parent::dispatch($request); } if (!$this->_customerSession->authenticate($this)) { $this->_actionFlag->set('', 'no-dispatch', true); } $customer = $this->_customerSession->getCustomer(); $this->_coreRegistry->register(RegistryConstants::CURRENT_CUSTOMER, $customer); $this->_coreRegistry->register(RegistryConstants::CURRENT_CUSTOMER_ID, $customer->getId()); return parent::dispatch($request); }
/** * Check customer authentication * * @param RequestInterface $request * @return \Magento\Framework\Controller\Result\Redirect|\Magento\Framework\App\ResponseInterface */ public function dispatch(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::dispatch($request); }
/** * 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 dispatch(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)) { $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::dispatch($request); }
/** * Dispatch request * * @param RequestInterface $request * @return \Magento\Framework\App\ResponseInterface */ public function dispatch(RequestInterface $request) { if (!$this->getRequest()->isDispatched()) { parent::dispatch($request); } $action = strtolower($this->getRequest()->getActionName()); $pattern = '/^(' . implode('|', $this->getAllowedActions()) . ')$/i'; if (!preg_match($pattern, $action)) { if (!$this->_getSession()->authenticate($this)) { $this->_actionFlag->set('', 'no-dispatch', true); } } else { $this->_getSession()->setNoReferer(true); } $result = parent::dispatch($request); $this->_getSession()->unsNoReferer(false); return $result; }
/** * Dispatch request * * @param RequestInterface $request * @return \Magento\Framework\App\ResponseInterface */ public function dispatch(RequestInterface $request) { $allowGuest = $this->_objectManager->get('Magento\\Review\\Helper\\Data')->getIsGuestAllowToWrite(); if (!$request->isDispatched()) { return parent::dispatch($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::dispatch($request); }
/** * @param \Magento\Framework\App\RequestInterface $request * @return \Magento\Framework\App\ResponseInterface */ public function dispatch(\Magento\Framework\App\RequestInterface $request) { if (!$this->_processUrlKeys()) { return parent::dispatch($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::dispatch($request); }
/** * @param RequestInterface $request * * @return ResponseInterface */ public function dispatch(RequestInterface $request) { if (!$this->config->isEnabled()) { $this->_redirect($this->_redirect->getRefererUrl()); } return parent::dispatch($request); }
/** * Dispatch request * * @param RequestInterface $request * @return \Magento\Framework\App\ResponseInterface * @throws \Magento\Framework\Exception\NotFoundException */ public function dispatch(RequestInterface $request) { return parent::dispatch($request); }
/** * Perform necessary checks for all actions * * Redirect out if system is already installed * Throw a bootstrap exception if page cannot be displayed due to mis-configured base directories * * @param RequestInterface $request * @return \Magento\Framework\App\ResponseInterface */ public function dispatch(RequestInterface $request) { if ($this->_appState->isInstalled()) { $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true); $this->_redirect('/'); } return parent::dispatch($request); }