/** * {@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); }
/** * {@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); }