lib/chook/server/public/js/chook.js in chook-1.1.0 vs lib/chook/server/public/js/chook.js in chook-1.1.1
- old
+ new
@@ -1,4 +1,24 @@
+// log out of basic auth by sending an incorrect name /pw
+// may not work on all browsers
+// see second comment at
+// https://stackoverflow.com/questions/233507/how-to-log-out-user-from-web-site-using-basic-authentication#492926
+
+function logout() {
+ //var logged_out_page = window.location.protocol + '//xxxx:xxxx@' + window.location.host + '/login';
+
+ var xhttp = new XMLHttpRequest();
+
+ xhttp.onreadystatechange = function() {
+ if (this.readyState == 4) {
+ window.location = "/login";
+ }
+ };
+
+ xhttp.open("GET", "/LOG_OUT:no_such_pw@logout", true);
+ xhttp.setRequestHeader("Authorization", "Basic " + btoa("LOG_OUT:no_such_pw"));
+ xhttp.send();
+}
// show the logbox
function view_log() {
document.getElementById("pause_log").checked = false
document.getElementById("logbox_div").style.display = 'block';