mirror of
https://github.com/hyzendust/hyzendust.github.io.git
synced 2026-06-30 23:12:16 +02:00
Fix: logout instantly if backend connection not established or user not found from db
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user