fix: Generate token function
This commit is contained in:
parent
821a0c405c
commit
dd50a175e6
@ -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
|
||||
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user