_customerSession = $customerSession; $this->_formKeyValidator = $formKeyValidator; $this->_formFactory = $formFactory; $this->_addressRepository = $addressRepository; $this->addressDataFactory = $addressDataFactory; $this->regionDataFactory = $regionDataFactory; $this->_dataProcessor = $dataProcessor; $this->dataObjectHelper = $dataObjectHelper; $this->resultForwardFactory = $resultForwardFactory; $this->resultPageFactory = $resultPageFactory; parent::__construct($context); } /** * Retrieve customer session object * * @return \Magento\Customer\Model\Session */ protected function _getSession() { return $this->_customerSession; } /** * Check customer authentication * * @param RequestInterface $request * @return \Magento\Framework\App\ResponseInterface */ public function dispatch(RequestInterface $request) { if (!$this->_getSession()->authenticate()) { $this->_actionFlag->set('', 'no-dispatch', true); } return parent::dispatch($request); } /** * @param string $route * @param array $params * @return string */ protected function _buildUrl($route = '', $params = []) { /** @var \Magento\Framework\UrlInterface $urlBuilder */ $urlBuilder = $this->_objectManager->create(\Magento\Framework\UrlInterface::class); return $urlBuilder->getUrl($route, $params); } }