Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

Administrator / level3-lesson18-diy1

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Commit 6e9101ba authored 3 years ago by BellCodeEditor's avatar BellCodeEditor
Browse files
Options
  • Browse Files
  • Download
  • Email Patches
  • Plain Diff

save project

parent 80e0e6d0
Show whitespace changes
Inline Side-by-side
Showing with 5 additions and 4 deletions
  • my_app.py
  • user.txt
my_app.py
View file @ 6e9101ba
...@@ -26,7 +26,7 @@ def register(): # 注册验证 ...@@ -26,7 +26,7 @@ def register(): # 注册验证
messagebox.showwarning("错误","两次密码不一致!") messagebox.showwarning("错误","两次密码不一致!")
else: else:
users[name] = password1 users[name] = password1
content = json.dumps(users,ascii(True)) content = json.dumps(users,ensure_ascii=False)
with open("user.txt","w",encoding="utf-8") as file: with open("user.txt","w",encoding="utf-8") as file:
file.write(content) file.write(content)
#成功跳往登陆界面 #成功跳往登陆界面
...@@ -35,8 +35,9 @@ def register(): # 注册验证 ...@@ -35,8 +35,9 @@ def register(): # 注册验证
def login(): # 登录验证 def login(): # 登录验证
name,password1 = app_login.get_input()
value= users.get(name) value= users.get(name)
if value == name: if value == password1:
messagebox.showinfo("成功","登录成功!") messagebox.showinfo("成功","登录成功!")
else: else:
messagebox.showwarning("错误","用户名或密码错误!") messagebox.showwarning("错误","用户名或密码错误!")
......
This diff is collapsed. Click to expand it.
user.txt
View file @ 6e9101ba
{"admin": "123456"} {"admin": "123456", "安抚": "123"}
\ No newline at end of file \ No newline at end of file
This diff is collapsed. Click to expand it.
  • Write
  • Preview
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