Compare commits

6 Commits

Author SHA1 Message Date
kou he
fc16a54a00 !5 edit readme
Merge pull request !5 from kou he/master
2022-03-26 05:17:37 +00:00
kou he
29c1f9da3f !3 显示密码错误次数
Merge pull request !3 from kou he/show-wrongtimes
2022-03-26 05:03:01 +00:00
kouhe
d93deb5950 show wrong time 2022-03-26 12:51:33 +08:00
kou he
e955e6df6c !2 fixed auto login
Merge pull request !2 from kou he/no-autologin
2022-03-26 04:35:28 +00:00
kouhe
3fb43da711 back to menu when register finished 2022-03-26 12:34:08 +08:00
kou he
ad13bfd453 !1 dev fetch
Merge pull request !1 from kou he/master
2022-03-26 04:25:17 +00:00

View File

@@ -20,6 +20,8 @@ while True:
else: else:
print("Wrong password!") print("Wrong password!")
wrong_time += 1 wrong_time += 1
# print you had wrong password wrong_time times, max 3 times
print("You had wrong password %d times, max 3 times" % wrong_time)
if wrong_time == 3: if wrong_time == 3:
print("Too many wrong password!") print("Too many wrong password!")
exit() exit()
@@ -28,7 +30,7 @@ while True:
elif input_number == "2": elif input_number == "2":
input_username = input("Enter a username\n") input_username = input("Enter a username\n")
input_password = input("Enter a password\n") input_password = input("Enter a password\n")
# check if the username is in the dictionary so it is duplicate # check if the username is in the dictionary it is duplicate
if input_username in username_and_password: if input_username in username_and_password:
print("The username is duplicate!") print("The username is duplicate!")
else: else:
@@ -65,12 +67,11 @@ while True:
# add the username and password to the dictionary # add the username and password to the dictionary
username_and_password[input_username] = input_password username_and_password[input_username] = input_password
print("Register successfully!") print("Register successfully!")
print("Auto login...") # back to menu
exit() continue
else: else:
print("Wrong number!") # if the input is not 1 or 2, it will print wrong number print("Wrong number!") # if the input is not 1 or 2, it will print wrong number
os.system("pause") os.system("pause")
os.system("cls") os.system("cls")
# clear the screen # clear the screen