BasicAuth Login/Logout eingebaut

This commit is contained in:
Sven Schmalle
2020-01-20 15:56:39 +01:00
parent fa880cdaed
commit d7e91ebdba
4 changed files with 59 additions and 9 deletions

View File

@ -124,6 +124,7 @@ mark {
<li id="btnPreviewpage"><a href="#" onclick="PreviewPage()">Preview</a></li>
<li id="btnSavepage"><a href="#" onclick="SavePage()">Save</a></li>
<li id="btnPDFgen"><a href="#" onclick="PDFGen()">PDF</a></li>
<li id="btnPDFgen"><a href="#" onclick="Logout()">Logout</a></li>
</ul>
<form class="navbar-form nav navbar-nav navbar-right" role="search">
<div class="input-group">
@ -370,6 +371,27 @@ mark {
});
}
function Logout(){
try {
// Hack for Firefox/Chrome
$.ajax({
url: "/",
username: 'reset',
password: 'reset',
// If the return is 401, refresh the page to request new details.
statusCode: { 401: function() {
location.reload();
}
}
});
} catch (exception) {
// Hack for IE only
if (!document.execCommand("ClearAuthenticationCache")) {
document.location = "http://reset:reset@" + document.location.hostname + document.location.pathname;
location.reload();
}
}
}
</script>
<script>
//--------------------------------------------------------------------------