Commit b19d2fcf by BellCodeEditor

save project

parent b159d416
Showing with 8 additions and 7 deletions
......@@ -3,7 +3,8 @@ from tkinter import messagebox
import json
with open ("user.txt","r",encoding="utf-8") as f:
info=f.read()
users=json.loads(info)
user=json.loads(info)
# global user
def login_to_reg(): # 登录界面转注册界面
app_login.root.destroy()
......@@ -18,16 +19,16 @@ def register(): # 注册验证
name,password1,password2=app_reg.get_input()
if name=='' and password1=='' and password2=='':
messagebox.showwarning("警告","请填写完整")
elif name in users:
elif name in user:
messagebox.showwarning("警告","用户以存在")
elif password1!=password2:
messagebox.showwarning("警告","两次密码不一样")
else:
users[name]=password1
user[name]=password1
messagebox.showwarning("警告","账号注册成功")
with open ("user.txt","w",encoding="utf-8") as f:
f.write(json.dumps(users))
users=json.loads(info)
f.write(json.dumps(user))
reg_to_login()
def login(): # 登录验证
pass
......
{"admin": "123456"}
\ No newline at end of file
{"admin": "123456", "12": "12"}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment