我一直在为python 3.6开发密码系统,这是我到目前为止所提出的:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://code.highcharts.com/js/highcharts.js"></script>
<div id="container"></div>
我正在尝试获取它,以便先前输入的密码更改为新输入的密码。
知道我可以添加什么以便更改该用户的密码吗?
答案 0 :(得分:1)
你必须添加:
users[login] = newpassw
所以:
users = {}
use = ""
while use != "q":
use = input("Are you a registered user y/n press q to close program.")
if status == "n":
createLogin = input("Create login name: ")
if createLogin in users:
print ("Login name already exist!\n")
else:
createPassw = input("Create password: ")
users[createLogin] = createPassw
print("\nUser created!\n")
elif status == "y":
login = input("Enter login name: ")
if login in users:
passw = input("Enter password: ")
if login in users and users[login] == passw:
print("Login successful!")
changepassword = input("Would you like to change your password?")
if cp in ["Y", "y"]:
newpassw = input("What do you want your new password to be?")
users[login] = newpassw
else:
print("User doesn't exist!\n")
PS:我建议您使用getpass