Browse Source

Check token length only when user is being created

master
mid-kid 2 weeks ago
parent
commit
491938d96e
  1. 4
      auth/auth.py

4
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:

Loading…
Cancel
Save