Commit 03b25731 by BellCodeEditor

save project

parent da261ed8
Showing with 11 additions and 11 deletions
......@@ -4,7 +4,7 @@ import json
with open("user.txt","r",encoding="utf-8")as f:
info=f.read()
users=json.loads(info)
uses=json.loads(info)
def login_to_reg(): # 登录界面转注册界面
app_login.root.destroy()
global app_reg
......@@ -22,21 +22,24 @@ def register(): # 注册验证
name,password1,password2=app_reg.get_input()
if name=="" or password1=="" or password2=="":
messagebox.showwarning("警告","请填写完整的资料")
elif name in users:
elif name in uses:
messagebox.showwarning("错误","用户已经存在")
elif password2 != password1:
messagebox.showwarning("错误","两次填写不正确")
else:
uses[name]=password1
con=json.dump(users)
users[name]=password1
con=json.dump(uses)
with open("user.txt","w",encoding="utf-8")as filo:
filo.write(con)
messagebox.showinfo("成功注册成功")
messagebox.showinfo("成功","注册成功")
app_reg.root.destroy()
app_login=My_login()
app_login.show()
def login(): # 登录验证
pass
name,password=app_login.get_input()
SB=uses.get(name)
if SB==password:
messagebox.showinfo("成功","登录成功")
class My_login(): # 登录窗口
def __init__(self):
......
{"admin": "123456"}
import tkinter
\ No newline at end of file
{"admin": "123456"}
\ 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