Example #1
0
 /**
  * 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);
 }