/**
  * Log into the application
  */
 public function loginAction()
 {
     $icinga = Icinga::app();
     if (($requiresSetup = $icinga->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()) {
             $this->getResponse()->setBody("Cookies must be enabled to run this application.\n")->setHttpResponseCode(403)->sendResponse();
             exit;
         }
         $form->handleRequest();
     }
     $this->view->form = $form;
     $this->view->title = $this->translate('Icinga Web 2 Login');
     $this->view->requiresSetup = $requiresSetup;
 }