process 401 and 403

This commit is contained in:
Devaev Maxim
2018-12-16 22:25:48 +03:00
parent b8df7a71fe
commit 18842fdd35
2 changed files with 22 additions and 7 deletions

View File

@@ -53,6 +53,8 @@ function __loadKvmdInfo() {
$("kvmd-meta-server-host").innerHTML = "";
document.title = "Pi-KVM Index";
}
} else if (http.status === 401 || http.status === 403) {
document.location.href = "/login";
} else {
setTimeout(__loadKvmdInfo, 1000);
}
@@ -76,7 +78,7 @@ function __makeApp(id, path, icon, name) {
function __logout() {
var http = tools.makeRequest("POST", "/kvmd/auth/logout", function() {
if (http.readyState === 4) {
if (http.status === 200) {
if (http.status === 200 || http.status === 401 || http.status === 403) {
document.location.href = "/login";
} else {
wm.error("Logout error:<br>", http.responseText);