diff --git a/accounts.py b/accounts.py index bcfdaa6..b4f43d6 100644 --- a/accounts.py +++ b/accounts.py @@ -33,6 +33,10 @@ def generate_cookie(): # Create a new user def create_user(email, domain, password): + if len(email) < 4 or len(domain) < 4 or len(password) < 4: + return {'success': False, 'message': 'Invalid email, domain, or password'} + + # Hash password hashed_password = hash_password(password) # Create user diff --git a/db.py b/db.py index 35420bf..1480f1b 100644 --- a/db.py +++ b/db.py @@ -27,7 +27,15 @@ def check_tables(): token VARCHAR(255) NOT NULL, PRIMARY KEY (id) ) - """) + """) + cursor.execute(""" + CREATE TABLE IF NOT EXISTS site ( + id INT(11) NOT NULL AUTO_INCREMENT, + domain VARCHAR(255) NOT NULL, + data VARCHAR(2048) NOT NULL, + PRIMARY KEY (id) + ) + """) cursor.close() connection.close() print("Checked tables")