Skip to content

Commit

Permalink
Merge pull request #6 from tylerlight071/Features
Browse files Browse the repository at this point in the history
Added confirm password
  • Loading branch information
tylerlight071 authored Jan 29, 2024
2 parents 3941d90 + e84a1ed commit b42f597
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions register.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,20 @@ def register():
if username in users:
print(Fore.RED + "\nUsername already exists. Please choose another one." + Style.RESET_ALL)
time.sleep(2)
return register()
password = getpass.getpass("Enter a password: ")
users[username] = password
save_data(users, USER_DATA_FILE)
print(Fore.GREEN + "\nRegistration successful!" + Style.RESET_ALL)
time.sleep(2)
clear_screen()
return

while True:
password = getpass.getpass("Enter a password: ")
confirm_password = getpass.getpass("Confirm your password: ")
if password == confirm_password:
users[username] = password
save_data(users, USER_DATA_FILE)
print(Fore.GREEN + "\nRegistration successful!" + Style.RESET_ALL)
time.sleep(2)
clear_screen()
break # Exit the loop when registration is successful
else:
print(Fore.RED + "\nPasswords do not match. Please try again." + Style.RESET_ALL)

if __name__ == "__main__":
register()

0 comments on commit b42f597

Please sign in to comment.