2014-02-26 17:36:20 +01:00
|
|
|
<!--
|
|
|
|
This view provides a workaround to logout from an external authentication provider, in case external
|
|
|
|
authentication was configured (the default is to handle authentications internally in Icingaweb2).
|
|
|
|
|
|
|
|
The <a href="http://tools.ietf.org/html/rfc2617">Http Basic and Digest Authentication</a> is not
|
|
|
|
designed to handle logout. When the user has provided valid credentials, the client is adviced to include these
|
|
|
|
in every further request until the browser was closed. To allow logout and to allow the user to change the
|
|
|
|
logged-in user this JavaScript provides a workaround to force a new authentication prompt in most browsers.
|
|
|
|
-->
|
2014-07-29 11:11:52 +02:00
|
|
|
<div class="content">
|
2014-02-26 17:36:20 +01:00
|
|
|
<div class="alert alert-warning" id="logout-status">
|
2015-03-11 15:14:13 +01:00
|
|
|
<b><?= $this->translate('Logging out...'); ?></b>
|
2015-03-11 15:06:07 +01:00
|
|
|
<br>
|
2015-03-11 15:14:13 +01:00
|
|
|
<?= $this->translate(
|
2015-03-11 15:06:58 +01:00
|
|
|
'If this message does not disappear, it might be necessary to quit the'
|
|
|
|
. ' current session manually by clearing the cache, or by closing the current'
|
|
|
|
. ' browser session.'
|
2014-02-26 17:36:20 +01:00
|
|
|
); ?>
|
|
|
|
</div>
|
|
|
|
|
2015-03-11 15:35:44 +01:00
|
|
|
<div class="container">
|
2015-03-11 15:14:13 +01:00
|
|
|
<a href="<?= $this->href('dashboard/index'); ?>"><?= $this->translate('Login'); ?></a>
|
2014-02-26 17:36:20 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
2015-03-11 14:51:59 +01:00
|
|
|
/*
|
2014-02-26 17:36:20 +01:00
|
|
|
* When JavaScript is available, trigger an XmlHTTPRequest with the non-existing user 'logout' and abort it
|
|
|
|
* before it is able to finish. This will cause the browser to show a new authentication prompt in the next
|
|
|
|
* request.
|
|
|
|
*/
|
2015-03-11 15:35:44 +01:00
|
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
|
|
var msg = document.getElementById('logout-status');
|
2014-02-26 17:36:20 +01:00
|
|
|
try {
|
|
|
|
if (navigator.userAgent.toLowerCase().indexOf('msie') !== -1) {
|
|
|
|
document.execCommand('ClearAuthenticationCache');
|
|
|
|
} else {
|
2015-03-11 15:08:10 +01:00
|
|
|
var xhttp = new XMLHttpRequest();
|
2014-02-26 17:36:20 +01:00
|
|
|
xhttp.open('GET', 'arbitrary url', true, 'logout', 'logout');
|
|
|
|
xhttp.send('');
|
|
|
|
xhttp.abort();
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
}
|
2015-03-11 15:35:44 +01:00
|
|
|
msg.innerHTML = '<?= $this->translate('Logout successful!'); ?>';
|
|
|
|
msg.className = 'alert alert-success';
|
2014-07-29 11:11:52 +02:00
|
|
|
});
|
2014-02-26 17:36:20 +01:00
|
|
|
</script>
|