Fix: logout instantly if backend connection not established or user not found from db

This commit is contained in:
hyzen
2026-06-09 12:41:12 +05:30
parent 84f84f773a
commit 15266c9184
45 changed files with 50 additions and 54 deletions

View File

@@ -168,16 +168,12 @@
}
})
.catch(function () {
// Network/404 error — count failures, force logout after 3
var fails =
parseInt(localStorage.getItem('f4_session_fails') || '0', 10) + 1;
localStorage.setItem('f4_session_fails', fails);
if (fails >= 3) {
localStorage.removeItem('f4_username');
localStorage.removeItem('f4_login_time');
localStorage.removeItem('f4_session_fails');
window.location.reload();
}
// Backend completely unreachable (404, files gone, server down)
// Force logout immediately
localStorage.removeItem('f4_username');
localStorage.removeItem('f4_login_time');
localStorage.removeItem('f4_session_fails');
window.location.reload();
});
})();
</script>