added min amount of keys to username and pass
This commit is contained in:
parent
39c3b09b81
commit
65a6216eff
@ -30,6 +30,10 @@ class User:
|
||||
input_username = input("Username: ")
|
||||
input_password = getpass("Password: ")
|
||||
|
||||
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')}")
|
||||
return False
|
||||
|
||||
hashed_password = UtilityHelper.computeHash(input_password)
|
||||
|
||||
# check if username is already taken
|
||||
@ -58,7 +62,12 @@ class User:
|
||||
# Get new password
|
||||
new_password = getpass("Enter your new password: ")
|
||||
check_new_password = getpass("Enter your new password again: ")
|
||||
while new_password != check_new_password:
|
||||
|
||||
|
||||
while new_password != check_new_password and len(new_password) < 4:
|
||||
if len(new_password) < 4:
|
||||
print(f"{UtilityHelper.warningMessage('Password should be atleast 4 characters long')}")
|
||||
if new_password != check_new_password:
|
||||
print(f"{UtilityHelper.warningMessage('Passwords do not match')}")
|
||||
new_password = getpass("Enter your new password: ")
|
||||
check_new_password = getpass("Enter your new password again: ")
|
||||
@ -76,6 +85,9 @@ class User:
|
||||
# Get new username
|
||||
new_username = input("Enter your new username: ")
|
||||
|
||||
if len(new_username) < 4:
|
||||
print(f"{UtilityHelper.errorMessage('Username should be atleast 4 characters long')}")
|
||||
return False
|
||||
# check if username is already taken
|
||||
if self.db.fetchUserByUsername(new_username):
|
||||
print(f"{UtilityHelper.errorMessage('Username already taken')}")
|
||||
|
Loading…
x
Reference in New Issue
Block a user