From ebc8cff3b4f15242ebed2bacf3811606171c1a38 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Thu, 18 Mar 2021 09:52:46 +0100 Subject: remove avatar column from users table --- api/auth/signup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'api') diff --git a/api/auth/signup.py b/api/auth/signup.py index 210ba94..0cd7628 100644 --- a/api/auth/signup.py +++ b/api/auth/signup.py @@ -48,7 +48,7 @@ def index(): password_hash = passwords.password_hash(password) registered = int( time.time() * 1000 ) - cursor.execute("insert into users values (?, ?, ?, NULL, NULL, ?, ?, \"[]\", FALSE, \"user\", \"{}\", NULL, \"online\") ", + cursor.execute("insert into users values (?, ?, ?, NULL, NULL, ?, ?, \"[]\", FALSE, \"user\", \"{}\", \"online\") ", (user_id, username, email, password_hash, registered)) connection.commit() -- cgit v1.2.3 From d0bf7f5c7ee5d688dfc418816fe08fc929c52ab1 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Thu, 18 Mar 2021 12:29:25 +0100 Subject: remove column avatar v2 --- api/user/info.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'api') diff --git a/api/user/info.py b/api/user/info.py index a9594aa..9a48f4d 100644 --- a/api/user/info.py +++ b/api/user/info.py @@ -29,7 +29,6 @@ def format_user(user_id, viewer = ''): "user_id", "country", "registered", - "avatar", "status", ]) + " from users where user_id = ?", [user_id]).fetchone() formatted_user = { @@ -37,8 +36,7 @@ def format_user(user_id, viewer = ''): "id": user[1], "country": user[2], "registered": user[3], - "avatar": user[4], - "status": user[5], + "status": user[4], "friends": count_friends(user_id), "rating": get_rating(user_id), } -- cgit v1.2.3 From b2ac9175084e1a67bee95dcea324dfdbb50fc8d2 Mon Sep 17 00:00:00 2001 From: daanoor Date: Thu, 18 Mar 2021 13:10:03 +0100 Subject: Comentaar toegevoegd * feest* --- api/auth/signup.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'api') diff --git a/api/auth/signup.py b/api/auth/signup.py index 0cd7628..d5d178a 100644 --- a/api/auth/signup.py +++ b/api/auth/signup.py @@ -6,14 +6,17 @@ import passwords import time import re +# Checks wheter the usename (at signup) exist of at least 3 and at most 35 charachters def validate_username(username): - return len(username) in range(3, 35 + 1) + return len(username) in range(3, 35 + 1) +# Checks if there's an '@' in the email (at signup) and if there's any input at all def validate_email(email): #TODO: use node_modules/email-validator/index.js return len(email) > 1 and \ "@" in email +# Checks wheter the signed up password consist of an uppercase, lowercase and a digit & the minimal length is 8 charachters def validate_password(password): passwordRegex = r"^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9]).{8,}$" # r"" = raw string return re.match(passwordRegex, password) @@ -22,6 +25,7 @@ signup = Blueprint('signup', __name__) @signup.route('/signup', methods = ['POST']) def index(): + # Requests information from endpoint 'signup', recieves username, email and password. It can also recieve an empty string, in that case the program will stop and return error code/http code '400' data = request.get_json() username = data.get("username") or "" @@ -33,6 +37,7 @@ def index(): not password: return "", 400 + # if not validate_username(username) or \ not validate_email(email) or \ not validate_password(password): -- cgit v1.2.3