empty == return

This commit is contained in:
Ryan Bakkes 2023-11-12 20:38:45 +01:00
parent 2b90572f1e
commit 65b1e8e0a2

View File

@ -11,8 +11,13 @@ class User:
self.password = password self.password = password
def login(self): def login(self):
print("Keep input empty to return")
input_username = input("Username: ") input_username = input("Username: ")
if input_username == "":
return False
input_password = getpass("Password: ") input_password = getpass("Password: ")
if input_password == "":
return False
hashed_password = UtilityHelper.computeHash(input_password) hashed_password = UtilityHelper.computeHash(input_password)
@ -27,8 +32,13 @@ class User:
return False return False
def register(self): def register(self):
print("Keep input empty to return")
input_username = input("Username: ") input_username = input("Username: ")
if input_username == "":
return False
input_password = getpass("Password: ") input_password = getpass("Password: ")
if input_password == "":
return False
if len(input_username) < 4 or len(input_password) < 4: if len(input_username) < 4 or len(input_password) < 4:
print(f"{UtilityHelper.errorMessage('Username or password is too short, inputs should be atleast 4 characters long')}") print(f"{UtilityHelper.errorMessage('Username or password is too short, inputs should be atleast 4 characters long')}")