Mercurial > gemma
annotate client/src/lib/session.js @ 303:75e32633fb96
Makefile: Force rebuild of dependencies when 3rdpartylibs.sh changes.
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Wed, 01 Aug 2018 13:37:48 +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 }; |