Commit cccb79d9 by BellCodeEditor

save project

parent b1a54cda
Showing with 23 additions and 4 deletions
import tkinter
from tkinter import messagebox
import json
with open("user.txt","r",encoding="utf-8") as file:
a=file.read()
toto=json.loads(a)
def login_to_reg(): # 登录界面转注册界面
app_login.root.destroy()
global app_register
......@@ -12,8 +17,21 @@ def reg_to_login(): # 注册界面转登录界面
app_login=My_login()
app_login.show()
def register(): # 注册验证
pass
name,password1,password2 = app_register.get_input()
if name=="" or password1=="" or password2=="":
messagebox.showwarning("错误","请填写完整注册信息!")
elif name in toto:
messagebox.showwarning("错误","该用户名已被注册!")
elif password1!=password2:
messagebox.showwarning("错误","两次密码不相符!")
else:
toto[name] = password1
cc = json.dumps(toto)
with open("user.txt","w",encoding='utf-8') as file:
file.write(cc)
messagebox.showinfo("成功","注册成功")
reg_to_login()
def login(): # 登录验证
pass
......@@ -59,6 +77,7 @@ class My_login(): # 登录窗口
self.password = self.e2.get()
return self.name, self.password
class My_register(): # 注册窗口
def __init__(self):
self.root = tkinter.Tk()
......
{"admin": "123456"}
\ No newline at end of file
{"admin": "123456", "23232323": "2323", "1111": "1111", "111": "111", "23333": "1111", "333333332": "2222"}
\ 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