Updated all global and local client packages
* Tweaked sessions to be a little more reliable on mobile
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user