diff --git a/CHATTER/file_test.py b/CHATTER/file_test.py new file mode 100644 index 0000000..1fc0d07 --- /dev/null +++ b/CHATTER/file_test.py @@ -0,0 +1,12 @@ +from pathlib import Path + +# This gets the directory where file_test.py actually lives +base_path = Path(__file__).parent +user_folder = base_path / "users" / "alice" + +if user_folder.exists() and user_folder.is_dir(): + # Proceed with login/fetching data + print("User exists.") +else: + # Handle 'User Not Found' + print("No such user.") \ No newline at end of file diff --git a/CHATTER/login_client.py b/CHATTER/login_client.py index e69de29..71b1635 100644 --- a/CHATTER/login_client.py +++ b/CHATTER/login_client.py @@ -0,0 +1,30 @@ +# LOGIN CLIENT +# HANDLES ACCOUNT CREATION AND VERIFICATION +from pathlib import Path +from datetime import datetime +import time + +# Sets the universal current path +script_dir = Path(__file__).parent + +def login_logic(): + while True: + print("LOGIN CLIENT") + print("[1] Login [2] Sign in") + login_choice = input(" > ") + + if login_choice == "1": + login_username = input("Username > ") + login_password = input("Password > ") + + # Get current time (request identifier) + timestamp_ms = int(time.time() * 1000) + + # Create a request + with open(script_dir / "requests" / f"{timestamp_ms}.txt", "w") as request: + request.write(f"LOGIN:{login_username}:{login_password}") + + +# The main thing +if __name__ == "__main__": + login_logic() diff --git a/CHATTER/requests/1775566784403.txt b/CHATTER/requests/1775566784403.txt new file mode 100644 index 0000000..c2d8a47 --- /dev/null +++ b/CHATTER/requests/1775566784403.txt @@ -0,0 +1 @@ +LOGIN:bob:bob_is_i \ No newline at end of file