From ea096bea77328cb5116758c2a04fc9cd22ae7e14 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Tue, 7 Jan 2025 12:42:00 -0500 Subject: [PATCH] valid signup --- services/web/project/__init__.py | 17 +++++++++-------- services/web/project/validate/validate.py | 3 +++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/services/web/project/__init__.py b/services/web/project/__init__.py index fdf8814..496bfee 100644 --- a/services/web/project/__init__.py +++ b/services/web/project/__init__.py @@ -374,13 +374,14 @@ def complete_register(): except: return jsonify({'status': 'INVALID', 'message': 'Link is invalid'}),403 - country = { - "last_update": datetime.datetime.utcnow(), - "list": [ - {"code":"US", "description": "United States" }, - {"code":"NG", "description": "Nigeria" }, - ] - } + is_validated = validate.validate_complete_signup_data(data.get('username'), data.get('password'), data.get('country')) + if is_validated is not True: + return dict(message='Invalid data', data=None, error=is_validated), 400 + username= data.get('username') + password= data.get('password') + country= data.get('country') + + user_uid = data['user']['uid'] #'a4b75649-e3c5-424f-bcdb-5481e625d24b' FIND_USER_DETAIL= "SELECT firstname,lastname,email, uid FROM members_pending WHERE uid::text = '"+user_uid+"'" @@ -393,7 +394,7 @@ def complete_register(): accountRes = json.dumps( [dict(ix) for ix in account] ) user_array = json.loads(accountRes) - return jsonify(status="VALID", user=user_array[0], pending_uid=user_uid,country=country) + return jsonify(status="VALID", user=user_array[0], pending_uid=user_uid) diff --git a/services/web/project/validate/validate.py b/services/web/project/validate/validate.py index 123436d..c36538b 100644 --- a/services/web/project/validate/validate.py +++ b/services/web/project/validate/validate.py @@ -22,6 +22,9 @@ def validate_username(username: str): def validate_signup_data(firstname,lastname,email): return True +def validate_complete_signup_data(username,password,country): + return True + def validate_username_and_password(username, password): """Username and Password Validator""" if not (username and password):