Mercurial > gemma
view client/src/lib/session.js @ 514:4a1db55a9920
Use auth.RunAs in JSON controller.
It's more symmetric to the rest of the application and
returns the database connection earlier to the pool.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 27 Aug 2018 10:35:55 +0200 |
parents | 27502291e564 |
children |
line wrap: on
line source
/** * Compares whether session is current * based on the expiry information and the * current date * * @param {number} expiresFromPastSession */ function sessionStillActive(expiresFromPastSession) { if (!expiresFromPastSession) return false; const now = Date.now(); const stillActive = now < expiresFromPastSession; return stillActive; } /** * Converts a given unix time to Milliseconds * * @param {string} timestring */ function toMillisFromString(timestring) { return timestring * 1000; } export { sessionStillActive, toMillisFromString };