public function init() { parent::init(); if (!$this->isAdmin()) { Admin::staticAdminLogon(); } }
/** * Acción que pinta un formulario genérico de login pra la zona restringida * @param string $route * @GET * @route /admin/login * @visible false * @return string HTML */ public function adminLogin($route = null) { if ($this->isAdmin()) { return $this->redirect('admin'); } else { return Admin::staticAdminLogon($route); } }
/** * Método que calcula el objeto a enrutar * * @param string|null $route * * @throws \Exception * @return string HTML */ public function execute($route) { Logger::log('Executing the request'); try { //Check CORS for requests RequestHelper::checkCORS(); // Checks restricted access SecurityHelper::checkRestrictedAccess($route); //Search action and execute $this->searchAction($route); } catch (AccessDeniedException $e) { Logger::log(_('Solicitamos credenciales de acceso a zona restringida')); return Admin::staticAdminLogon($route); } catch (RouterException $r) { if (null === RouterHelper::checkDefaultRoute($route)) { Logger::log($r->getMessage(), LOG_WARNING); throw $r; } } catch (\Exception $e) { Logger::log($e->getMessage(), LOG_ERR); throw $e; } return $this->httpNotFound(); }