Merge pull request #3584 from Icinga/fix/usergroups-not-loaded-for-externally-authenticated-users-3583

auth/external: Use a stripped down layout for the logout workaround
This commit is contained in:
Eric Lippmann 2018-11-15 11:29:44 +01:00 committed by GitHub
commit 72f2158baa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 67 additions and 1 deletions

View File

@ -74,6 +74,7 @@ class AuthenticationController extends Controller
AuthenticationHook::triggerLogout($auth->getUser()); AuthenticationHook::triggerLogout($auth->getUser());
$auth->removeAuthorization(); $auth->removeAuthorization();
if ($isExternalUser) { if ($isExternalUser) {
$this->view->layout()->setLayout('external-logout');
$this->getResponse()->setHttpResponseCode(401); $this->getResponse()->setHttpResponseCode(401);
} else { } else {
$this->redirectToLogin(); $this->redirectToLogin();

View File

@ -0,0 +1,33 @@
<?php
use Icinga\Util\Translator;
$lang = Translator::splitLocaleCode()->language;
$showFullscreen = $this->layout()->showFullscreen;
$innerLayoutScript = $this->layout()->innerLayout . '.phtml';
?><!DOCTYPE html>
<!--[if IE 8]>
<html class="no-js ie8" lang="<?= $lang ?>"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="<?= $lang ?>"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="google" value="notranslate">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta http-equiv="cleartype" content="on">
<title><?= $this->title ? $this->escape($this->title) : $this->defaultTitle ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="application-name" content="Icinga Web 2">
<meta name="apple-mobile-web-app-title" content="Icinga">
<link rel="mask-icon" href="<?= $this->baseUrl('img/website-icon.svg') ?>" color="#0096BF">
<link type="image/png" rel="shortcut icon" href="<?= $this->baseUrl('img/favicon.png') ?>" />
<link rel="apple-touch-icon" href="<?= $this->baseUrl('img/touch-icon.png') ?>">
</head>
<body id="body">
<div id="layout" class="default-layout<?php if ($showFullscreen): ?> fullscreen-layout<?php endif ?>">
<?= $this->render($innerLayoutScript); ?>
</div>
</body>
</html>

View File

@ -8,6 +8,7 @@
logged-in user this JavaScript provides a workaround to force a new authentication prompt in most browsers. logged-in user this JavaScript provides a workaround to force a new authentication prompt in most browsers.
--> -->
<div class="content"> <div class="content">
<div id="icinga-logo" aria-hidden="true"></div>
<div class="alert alert-warning" id="logout-status"> <div class="alert alert-warning" id="logout-status">
<b><?= $this->translate('Logging out...'); ?></b> <b><?= $this->translate('Logging out...'); ?></b>
<br> <br>
@ -19,7 +20,7 @@
</div> </div>
<div class="container"> <div class="container">
<a href="<?= $this->href('dashboard/index?renderLayout'); ?>"><?= $this->translate('Login'); ?></a> <a href="<?= $this->href('dashboard'); ?>"><?= $this->translate('Login'); ?></a>
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
@ -45,3 +46,34 @@
msg.className = 'alert alert-success'; msg.className = 'alert alert-success';
}); });
</script> </script>
<style type="text/css">
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
background-color: #0095bf;
color: white;
}
.content {
text-align: center;
}
#icinga-logo {
background-image: url('../img/icinga-logo-big.svg');
background-position: center bottom;
background-repeat: no-repeat;
background-size: contain;
height: 177px;
margin-top: 10em;
width: 100%;
}
#logout-status {
margin: 2em 0 1em;
font-size: 2em;
font-weight: bold;
}
.container a {
color: white;
font-size: 1.5em;
}
</style>