Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
level3-lesson18-diy2
This project
Loading...
Sign in
Toggle navigation
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
d37f191b
authored
Jun 05, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
37d31183
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
3 deletions
my_app.py
user.txt
my_app.py
View file @
d37f191b
...
@@ -22,9 +22,25 @@ def register(): # 注册验证
...
@@ -22,9 +22,25 @@ def register(): # 注册验证
name
,
password1
,
password2
=
app_reg
.
get_input
()
name
,
password1
,
password2
=
app_reg
.
get_input
()
if
name
==
""
or
password1
==
""
or
password2
==
""
:
if
name
==
""
or
password1
==
""
or
password2
==
""
:
messagebox
.
showwarning
(
"warning!"
,
"please fill these compelitly"
)
messagebox
.
showwarning
(
"warning!"
,
"please fill these compelitly"
)
elif
name
in
user
:
messagebox
.
showwarning
(
"tips"
,
"this has already had"
)
elif
password1
!=
password2
:
messagebox
.
showwarning
(
"warnning"
,
'two passwords are not the same'
)
else
:
user
[
name
]
=
password1
content
=
json
.
dumps
(
user
)
with
open
(
"user.txt"
,
"w"
,
encoding
=
"utf-8"
)
as
file
:
file
.
write
(
content
)
messagebox
.
showinfo
(
"success"
,
"register is okey"
)
reg_to_login
()
def
login
():
# 登录验证
def
login
():
# 登录验证
pass
name
,
password
=
app_login
.
get_input
()
pwd
=
user
[
name
]
if
pwd
==
password
:
messagebox
.
showinfo
(
"success"
,
"login is okey"
)
else
:
messagebox
.
showwarning
(
"wrong"
,
"there is something wrong"
)
class
My_login
():
# 登录窗口
class
My_login
():
# 登录窗口
def
__init__
(
self
):
def
__init__
(
self
):
...
...
user.txt
View file @
d37f191b
{"admin": "123456"}
{"admin": 12345, "111": "12", "112": "12", "222": "11"}
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment