preDispatch() protected method

Pre dispatch mount point
protected preDispatch ( string $module, string $controller, array $params = [] ) : void
$module string
$controller string
$params array
return void
Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  *
  * @param string $module
  * @param string $controller
  * @param array $params
  * @return void
  */
 protected function preDispatch($module, $controller, $params = array())
 {
     // auth as CLI user
     $cliUser = Table::findRowWhere(['login' => 'system']);
     Auth::setIdentity($cliUser);
     parent::preDispatch($module, $controller, $params);
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  *
  * @param string $module
  * @param string $controller
  * @param array $params
  * @return void
  */
 protected function preDispatch($module, $controller, $params = array())
 {
     // example of setup default title
     Layout::title("Bluz Skeleton");
     // apply "remember me" function
     if (!$this->user() && !empty($_COOKIE['rToken']) && !empty($_COOKIE['rId'])) {
         // try to login
         try {
             Auth\Table::getInstance()->authenticateCookie($_COOKIE['rId'], $_COOKIE['rToken']);
         } catch (AuthException $e) {
             $this->getResponse()->setCookie('rId', '', 1, '/');
             $this->getResponse()->setCookie('rToken', '', 1, '/');
         }
     }
     parent::preDispatch($module, $controller, $params);
 }