updates on the time duration for the logout
This commit is contained in:
@@ -21,9 +21,9 @@ const IDLE_CHECK_INTERVAL_MS = 15000;
|
||||
|
||||
// Two independent timers, both enforced from localStorage so every tab on the
|
||||
// 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.
|
||||
// - 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
|
||||
// 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
|
||||
@@ -60,7 +60,7 @@ const useInactivityLogout = () => {
|
||||
if (isSessionActive()) {
|
||||
if (!localStorage.getItem(ACTIVITY_STORAGE_KEY)) markActivity();
|
||||
// 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.
|
||||
if (!localStorage.getItem(SESSION_START_STORAGE_KEY)) markSessionStart();
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
export const ACTIVITY_STORAGE_KEY = 'lastActivityTime';
|
||||
export const SESSION_START_STORAGE_KEY = 'sessionStartTime';
|
||||
export const AUTH_PRESENCE_KEY = 'authname';
|
||||
export const INACTIVITY_TIMEOUT_MS = 15 * 60 * 1000; // 15 minutes, resets on user activity
|
||||
export const ABSOLUTE_SESSION_TIMEOUT_MS = 30 * 60 * 1000; // 30 minutes, hard cap since login regardless of activity
|
||||
export const INACTIVITY_TIMEOUT_MS = 60 * 60 * 1000; // 1 hour, resets on user activity
|
||||
export const ABSOLUTE_SESSION_TIMEOUT_MS = 60 * 60 * 1000; // 1 hour, hard cap since login regardless of activity
|
||||
|
||||
export const markActivity = () => {
|
||||
localStorage.setItem(ACTIVITY_STORAGE_KEY, String(Date.now()));
|
||||
|
||||
Reference in New Issue
Block a user