From e2b257c6da27eca4285b658309d91a9214263155 Mon Sep 17 00:00:00 2001 From: p7mj Date: Tue, 7 Apr 2026 09:37:51 -0400 Subject: [PATCH] 0407 0937 --- CHATTER/login_client.py | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/CHATTER/login_client.py b/CHATTER/login_client.py index 71b1635..de11c7e 100644 --- a/CHATTER/login_client.py +++ b/CHATTER/login_client.py @@ -1,5 +1,6 @@ # LOGIN CLIENT # HANDLES ACCOUNT CREATION AND VERIFICATION +# user validity check: no spaces no slashes no unprintable ASCII characters no carriage returns or anything like that from pathlib import Path from datetime import datetime import time @@ -14,7 +15,13 @@ def login_logic(): login_choice = input(" > ") if login_choice == "1": - login_username = input("Username > ") + while True: + login_username = input("Username > ") + if login_username.isalnum: + break + else: + print("Your username contains spaces or symbols! Check again.") + login_password = input("Password > ") # Get current time (request identifier) @@ -23,6 +30,29 @@ def login_logic(): # Create a request with open(script_dir / "requests" / f"{timestamp_ms}.txt", "w") as request: request.write(f"LOGIN:{login_username}:{login_password}") + + # TODO WAIT FOR SUCCESS/UNSUCCESS MESSAGE + + if login_choice == "2": + while True: + signup_username = input("New Username > ") + if signup_username.isalnum(): + break + else: + print("Cannot include spaces or symbols!") + + while True: + signup_password = input("Password > ") + signup_password_rep = input("Repeat Password > ") + if signup_password == signup_password_rep: + break + else: + print("Passwords are not the same!") + + with open(script_dir / "requests" / f"{timestamp_ms}.txt", "w") as request: + request.write(f"CREATEUSER:{signup_username}:{signup_password}") + + # TODO WAIT FOR SUCCESS/UNSUCCESS MESSAGE # The main thing