requiresSetup()) && $icinga->setupTokenExists()) { $this->redirectNow(Url::fromPath('setup')); } $form = new LoginForm(); if ($this->Auth()->isAuthenticated()) { $this->redirectNow($form->getRedirectUrl()); } if (! $requiresSetup) { if (! $this->getRequest()->hasCookieSupport()) { echo $this->translate("Cookies must be enabled to run this application.\n"); $this->getResponse()->setHttpResponseCode(403)->sendHeaders(); exit(); } $form->handleRequest(); } $this->view->form = $form; $this->view->title = $this->translate('Icinga Web 2 Login'); $this->view->requiresSetup = $requiresSetup; } /** * Log out the current user */ public function logoutAction() { $auth = $this->Auth(); if (! $auth->isAuthenticated()) { $this->redirectToLogin(); } // Get info whether the user is externally authenticated before removing authorization which destroys the // session and the user object $isExternalUser = $auth->getUser()->isExternalUser(); $auth->removeAuthorization(); if ($isExternalUser) { $this->getResponse()->setHttpResponseCode(401); } else { $this->redirectToLogin(); } } }