/**
  * Delete cookie with reason of logout
  *
  * @return $this
  */
 public function deleteLogoutReasonCookie()
 {
     $metaData = $this->createCookieMetaData();
     $metaData->setPath('/' . $this->backendData->getAreaFrontName())->setDuration(-1);
     $this->phpCookieManager->setPublicCookie(self::LOGOUT_REASON_CODE_COOKIE_NAME, '', $metaData);
     return $this;
 }
 /**
  * Process path info
  *
  * @param \Magento\Framework\App\RequestInterface $request
  * @param string $pathInfo
  * @return string
  */
 public function process(\Magento\Framework\App\RequestInterface $request, $pathInfo)
 {
     $pathParts = explode('/', ltrim($pathInfo, '/'), 2);
     $firstPart = $pathParts[0];
     if ($firstPart != $this->_helper->getAreaFrontName()) {
         return $this->_subject->process($request, $pathInfo);
     }
     return $pathInfo;
 }
Beispiel #3
0
 /**
  * Log out user and redirect him to new admin custom url
  *
  * @return void
  * @SuppressWarnings(PHPMD.ExitExpression)
  */
 public function afterCustomUrlChanged()
 {
     if (is_null($this->_coreRegistry->registry('custom_admin_path_redirect'))) {
         return;
     }
     $this->_authSession->destroy();
     $route = $this->_backendData->getAreaFrontName();
     $this->_response->setRedirect($this->_storeManager->getStore()->getBaseUrl() . $route)->sendResponse();
     exit(0);
 }
 /**
  * Log out user and redirect him to new admin custom url
  *
  * @param \Magento\Framework\Event\Observer $observer
  * @return void
  * @SuppressWarnings(PHPMD.ExitExpression)
  */
 public function execute(\Magento\Framework\Event\Observer $observer)
 {
     if ($this->_coreRegistry->registry('custom_admin_path_redirect') === null) {
         return;
     }
     $this->_authSession->destroy();
     $route = $this->_backendData->getAreaFrontName();
     $this->_response->setRedirect($this->_storeManager->getStore()->getBaseUrl() . $route)->sendResponse();
     exit(0);
 }
Beispiel #5
0
 /**
  * Check and process no route request
  *
  * @param \Magento\Framework\App\RequestInterface $request
  * @return bool
  */
 public function process(\Magento\Framework\App\RequestInterface $request)
 {
     $requestPathParams = explode('/', trim($request->getPathInfo(), '/'));
     $areaFrontName = array_shift($requestPathParams);
     if ($areaFrontName == $this->helper->getAreaFrontName()) {
         $moduleName = $this->routeConfig->getRouteFrontName('adminhtml');
         $actionNamespace = 'noroute';
         $actionName = 'index';
         $request->setModuleName($moduleName)->setControllerName($actionNamespace)->setActionName($actionName);
         return true;
     }
     return false;
 }
Beispiel #6
0
 /**
  * Return backend area front name, defined in configuration
  *
  * @return string
  */
 public function getAreaFrontName()
 {
     if (!$this->_getData('area_front_name')) {
         $this->setData('area_front_name', $this->_backendHelper->getAreaFrontName());
     }
     return $this->_getData('area_front_name');
 }
 public function testGetAreaFrontNameLocalConfigCustomFrontName()
 {
     $this->_frontResolverMock->expects($this->once())->method('getFrontName')->will($this->returnValue('custom_backend'));
     $this->assertEquals('custom_backend', $this->_helper->getAreaFrontName());
 }