aboutsummaryrefslogtreecommitdiff
path: root/api
diff options
context:
space:
mode:
authorlonkaars <l.leblansch@gmail.com>2021-03-16 11:32:51 +0100
committerlonkaars <l.leblansch@gmail.com>2021-03-16 11:32:51 +0100
commit3204a98c80cde2947b81d067c0fd9e448e12c757 (patch)
tree75392345aa23261cf8a5b289ff82f93da48472f9 /api
parent9abc6a25c89251659c5ffe2f59f6379cbf9f8e04 (diff)
remove stale tokens from database
Diffstat (limited to 'api')
-rw-r--r--api/auth/token.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/api/auth/token.py b/api/auth/token.py
index 0085187..d2eea52 100644
--- a/api/auth/token.py
+++ b/api/auth/token.py
@@ -5,7 +5,8 @@ import json
import time
def valid_tokens(user_id):
- return json.loads(cursor.execute("select valid_tokens from users where user_id = ?", [user_id]).fetchone()[0])
+ tokens = json.loads(cursor.execute("select valid_tokens from users where user_id = ?", [user_id]).fetchone()[0])
+ return [token for token in tokens if token["expirationDate"] > int( time.time() * 1000 )]
def validate_token(user_id, token):
tokens = valid_tokens(user_id)