From f7eeeccb0811887449149b46cf0592c30b9919a2 Mon Sep 17 00:00:00 2001 From: gumi Date: Fri, 6 Mar 2020 16:29:51 -0500 Subject: only give 30 minutes to click a login link --- src/routers/vault/utils/ephemeral.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/routers/vault/utils/ephemeral.js b/src/routers/vault/utils/ephemeral.js index 211e84b..570600c 100644 --- a/src/routers/vault/utils/ephemeral.js +++ b/src/routers/vault/utils/ephemeral.js @@ -11,13 +11,17 @@ const session_handler = { if (obj === null || obj === undefined) return obj; - if (Reflect.has(obj, timeout_symbol)) + let minutes = 30; + + if (Reflect.has(obj, timeout_symbol)) { clearTimeout(obj[timeout_symbol]); + minutes = 360; // 6 hours + } let expires = new Date(); - expires.setUTCHours(expires.getUTCHours() + 6); + expires.setUTCMinutes(expires.getUTCMinutes() + minutes); obj.expires = expires // this could also be a symbol - obj[timeout_symbol] = setTimeout(() => session_handler.delete(key), 6 * 3600000); // 6 hours + obj[timeout_symbol] = setTimeout(() => session_handler.delete(key), minutes * 60000); return obj; }, -- cgit v1.2.3-60-g2f50