diff --git a/accounts.py b/accounts.py index 65b3f51..bcfdaa6 100644 --- a/accounts.py +++ b/accounts.py @@ -26,12 +26,8 @@ def verify_password(password, hashed_password): def generate_cookie(): token = os.urandom(24).hex() # Verify token doesn't already exist - with open('users.json', 'r') as f: - users = json.load(f) - for user in users: - if token in user['tokens']: - print('Token already exists, generating new one') - return generate_cookie() + while db.search_users_token(token) != []: + token = os.urandom(24).hex() return token diff --git a/sites/slds.py b/sites/slds.py index a1e1d74..39bfeb8 100644 --- a/sites/slds.py +++ b/sites/slds.py @@ -5,8 +5,7 @@ import requests import json import schedule import time -from email_validator import validate_email, EmailNotValidError -import accounts + app = Flask(__name__) dotenv.load_dotenv()