updates on the time duration for the logout

This commit is contained in:
2026-07-08 11:21:04 +05:30
parent 6b3f225b24
commit d5bde7d1ac
2 changed files with 5 additions and 5 deletions

View File

@@ -21,9 +21,9 @@ const IDLE_CHECK_INTERVAL_MS = 15000;
// Two independent timers, both enforced from localStorage so every tab on the // Two independent timers, both enforced from localStorage so every tab on the
// origin agrees: // origin agrees:
// - INACTIVITY_TIMEOUT_MS: logs out after 15 minutes with no interaction, so // - INACTIVITY_TIMEOUT_MS: logs out after 1 hour with no interaction, so
// a laptop left unlocked doesn't leave the console open indefinitely. // a laptop left unlocked doesn't leave the console open indefinitely.
// - ABSOLUTE_SESSION_TIMEOUT_MS: a hard 30-minute cap since login, even if // - ABSOLUTE_SESSION_TIMEOUT_MS: a hard 1-hour cap since login, even if
// the user has been continuously active, so localStorage (auth keys, FCM // the user has been continuously active, so localStorage (auth keys, FCM
// token, cached zone list) never lingers on disk longer than that. // token, cached zone list) never lingers on disk longer than that.
// A logout in one tab (auth key cleared) is picked up by the others via the // A logout in one tab (auth key cleared) is picked up by the others via the
@@ -60,7 +60,7 @@ const useInactivityLogout = () => {
if (isSessionActive()) { if (isSessionActive()) {
if (!localStorage.getItem(ACTIVITY_STORAGE_KEY)) markActivity(); if (!localStorage.getItem(ACTIVITY_STORAGE_KEY)) markActivity();
// Sessions that were already open before this feature shipped won't have // Sessions that were already open before this feature shipped won't have
// a start time yet — give them a fresh 30-minute window instead of // a start time yet — give them a fresh 1-hour window instead of
// treating them as already expired. // treating them as already expired.
if (!localStorage.getItem(SESSION_START_STORAGE_KEY)) markSessionStart(); if (!localStorage.getItem(SESSION_START_STORAGE_KEY)) markSessionStart();
} }

View File

@@ -6,8 +6,8 @@
export const ACTIVITY_STORAGE_KEY = 'lastActivityTime'; export const ACTIVITY_STORAGE_KEY = 'lastActivityTime';
export const SESSION_START_STORAGE_KEY = 'sessionStartTime'; export const SESSION_START_STORAGE_KEY = 'sessionStartTime';
export const AUTH_PRESENCE_KEY = 'authname'; export const AUTH_PRESENCE_KEY = 'authname';
export const INACTIVITY_TIMEOUT_MS = 15 * 60 * 1000; // 15 minutes, resets on user activity export const INACTIVITY_TIMEOUT_MS = 60 * 60 * 1000; // 1 hour, resets on user activity
export const ABSOLUTE_SESSION_TIMEOUT_MS = 30 * 60 * 1000; // 30 minutes, hard cap since login regardless of activity export const ABSOLUTE_SESSION_TIMEOUT_MS = 60 * 60 * 1000; // 1 hour, hard cap since login regardless of activity
export const markActivity = () => { export const markActivity = () => {
localStorage.setItem(ACTIVITY_STORAGE_KEY, String(Date.now())); localStorage.setItem(ACTIVITY_STORAGE_KEY, String(Date.now()));