Redirect to login page when auto-refreshing a (part of a) page while being logged out (#5951)

This commit is contained in:
mhoogveld
2021-05-29 06:45:11 +02:00
committed by GitHub
parent b94fafbfb9
commit bcf2366dbd
8 changed files with 86 additions and 23 deletions

View File

@@ -80,9 +80,17 @@
}
loadXmlHttp.prototype.stateChanged=function () {
if (this.xmlHttp.readyState == 4 && (this.xmlHttp.status == 200 || !/^http/.test(window.location.href)))
//this.el.innerHTML = this.xmlHttp.responseText;
document.getElementById('ajax_response').innerHTML = this.xmlHttp.responseText;
var url = new URL(this.xmlHttp.responseURL);
if (/login\.php$/.test(url.pathname)) {
// You are logged out. Stop refresh!
url.searchParams.set('path', '<?php echo $_SERVER['REQUEST_URI']; ?>');
window.location.href = url.href;
return;
}
if (this.xmlHttp.readyState == 4 && (this.xmlHttp.status == 200 || !/^http/.test(window.location.href)))
//this.el.innerHTML = this.xmlHttp.responseText;
document.getElementById('ajax_response').innerHTML = this.xmlHttp.responseText;
}
var requestTime = function() {