From 491938d96efd452586aff84019d4b54e173692a8 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Sat, 11 Jan 2025 19:06:48 +0100 Subject: [PATCH] Check token length only when user is being created --- auth/auth.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/auth/auth.py b/auth/auth.py index e79173f..0ca1aa9 100644 --- a/auth/auth.py +++ b/auth/auth.py @@ -19,8 +19,6 @@ class Authentication: "CREATE TABLE IF NOT EXISTS new(user)") def check_token(self, profileId, token): - if len(token) != 43: - return False with self.connect() as c: res = c.execute("SELECT token FROM users WHERE profileId=?", (profileId,)).fetchone() @@ -37,6 +35,8 @@ class Authentication: return res[0] == user # Check if new user can be created + if len(token) != 43: + return False res = c.execute("SELECT 1 FROM new WHERE user=?", (user,)).fetchone() if res is None or res[0] != 1: