Mercurial > gemma
annotate client/src/lib/session.js @ 316:423d0f1d8ee0
JSON input is not used when doing a password reset.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 02 Aug 2018 10:04:54 +0200 |
parents | 4bf2173748f3 |
children | 27502291e564 |
rev | line source |
---|---|
162
9908260d1e6a
Refactor: Login expiry refactored to lib
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
1 function sessionStillActive(expiresFromPastSession) { |
9908260d1e6a
Refactor: Login expiry refactored to lib
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
2 if (!expiresFromPastSession) return false; |
9908260d1e6a
Refactor: Login expiry refactored to lib
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
3 const now = Date.now(); |
165
4bf2173748f3
refactor: extracted the string to milisecondconversion
Thomas Junk <thomas.junk@intevation.de>
parents:
163
diff
changeset
|
4 const stillActive = now < expiresFromPastSession; |
162
9908260d1e6a
Refactor: Login expiry refactored to lib
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
5 return stillActive; |
9908260d1e6a
Refactor: Login expiry refactored to lib
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
6 } |
9908260d1e6a
Refactor: Login expiry refactored to lib
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
7 |
165
4bf2173748f3
refactor: extracted the string to milisecondconversion
Thomas Junk <thomas.junk@intevation.de>
parents:
163
diff
changeset
|
8 function toMillisFromString(timestring) { |
4bf2173748f3
refactor: extracted the string to milisecondconversion
Thomas Junk <thomas.junk@intevation.de>
parents:
163
diff
changeset
|
9 return timestring * 1000; |
4bf2173748f3
refactor: extracted the string to milisecondconversion
Thomas Junk <thomas.junk@intevation.de>
parents:
163
diff
changeset
|
10 } |
4bf2173748f3
refactor: extracted the string to milisecondconversion
Thomas Junk <thomas.junk@intevation.de>
parents:
163
diff
changeset
|
11 |
4bf2173748f3
refactor: extracted the string to milisecondconversion
Thomas Junk <thomas.junk@intevation.de>
parents:
163
diff
changeset
|
12 export { sessionStillActive, toMillisFromString }; |