Updated all global and local client packages

* Tweaked sessions to be a little more reliable on mobile
This commit is contained in:
Max G
2020-06-21 02:07:36 +00:00
parent 0bbdda9a2a
commit 8b711ab508
8 changed files with 245 additions and 102 deletions

View File

@@ -49,7 +49,7 @@ Auth.decodeToken = (token, request = null) => {
//Delete all tokens older than 20 days before continuing or inacive and older than 1 minute
const now = (Math.floor((+new Date)/1000))
const twentyDays = (Math.floor((+new Date)/1000)) - (86400 * 20)
const thirtySeconds = (Math.floor((+new Date)/1000)) - (30)
const fourtyFiveSeconds = (Math.floor((+new Date)/1000)) - (45)
//Decode Json web token
jwt.verify(token, tokenSecretKey, function(err, decoded){
@@ -59,7 +59,11 @@ Auth.decodeToken = (token, request = null) => {
decodedToken = decoded
db.promise().query('DELETE from user_active_session WHERE (created < ?) OR (active = false AND last_used < ?)', [twentyDays, thirtySeconds])
db.promise().query(`DELETE from user_active_session WHERE
(created < ?) OR
(active = 0 AND last_used < ?) OR
(uses = 0)
`, [twentyDays, fourtyFiveSeconds])
.then((r,f) => {
//Lookup session data in database