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
@@ -440,6 +440,12 @@ if (!class_exists('destinations')) {
//alert(action);
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
var url = new URL(this.xmlHttp.responseURL);
if (/login\.php$/.test(url.pathname)) {
// You are logged out. Not much we can de here.
return;
}
if (this.readyState == 4 && this.status == 200) {
document.getElementById(id).innerHTML = this.responseText;
}