login: Show a note if the only active external auth backend is not available

refs #8274
This commit is contained in:
Johannes Meyer 2015-01-27 14:26:06 +01:00
parent 23c36898da
commit 7ad44b8411
3 changed files with 23 additions and 0 deletions

View File

@ -39,6 +39,7 @@ class AuthenticationController extends ActionController
$this->redirectNow(Url::fromPath('setup'));
}
$triedOnlyExternalAuth = null;
$auth = $this->Auth();
$this->view->form = $form = new LoginForm();
$this->view->title = $this->translate('Icingaweb Login');
@ -126,6 +127,7 @@ class AuthenticationController extends ActionController
} elseif ($request->isGet()) {
$user = new User('');
foreach ($chain as $backend) {
$triedOnlyExternalAuth = $triedOnlyExternalAuth === null;
if ($backend instanceof ExternalBackend) {
$authenticated = $backend->authenticate($user);
if ($authenticated === true) {
@ -134,6 +136,8 @@ class AuthenticationController extends ActionController
Url::fromPath(Url::fromRequest()->getParam('redirect', 'dashboard'))
);
}
} else {
$triedOnlyExternalAuth = false;
}
}
}
@ -141,6 +145,7 @@ class AuthenticationController extends ActionController
$this->view->errorInfo = $e->getMessage();
}
$this->view->requiresExternalAuth = $triedOnlyExternalAuth && !$auth->isAuthenticated();
$this->view->requiresSetup = Icinga::app()->requiresSetup();
}

View File

@ -16,6 +16,15 @@
'<a href="' . $this->href('setup') . '" title="' . $this->translate('Icinga Web 2 Setup-Wizard') . '">',
'</a>'
); ?></p>
<?php elseif ($requiresExternalAuth): ?>
<p class="icon-info info-box"><?= sprintf(
$this->translate(
'You\'re currently not authenticated using any of the web server\'s authentication mechanisms.'
. ' Make sure you\'ll configure such either by using the %s or by setting it up manually,'
. ' otherwise you\'ll not be able to login.'
),
'<em title="icingacli help users">IcingaCLI</em>'
); ?></p>
<?php endif ?>
<h1><?= $this->translate('Welcome to Icinga Web 2'); ?></h1>
<?php

View File

@ -126,6 +126,15 @@
font-weight: bold;
}
}
p.info-box {
width: 50%;
margin: 0 auto 2.5em;
em {
text-decoration: underline;
}
}
}
/* make keyframes that tell the start state and the end state of our object */