summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgumi <git@gumi.ca>2020-03-06 16:29:51 -0500
committergumi <git@gumi.ca>2020-03-06 16:29:51 -0500
commitf7eeeccb0811887449149b46cf0592c30b9919a2 (patch)
tree0ca840981e98978d08a2fa61f7d9568bc516dd2e
parent86be43f1c0143495abe003654a4e415a154b11d4 (diff)
downloadapi-f7eeeccb0811887449149b46cf0592c30b9919a2.tar.gz
api-f7eeeccb0811887449149b46cf0592c30b9919a2.tar.bz2
api-f7eeeccb0811887449149b46cf0592c30b9919a2.tar.xz
api-f7eeeccb0811887449149b46cf0592c30b9919a2.zip
only give 30 minutes to click a login link
-rw-r--r--src/routers/vault/utils/ephemeral.js10
1 files 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;
},