regiser.py
from setting import *
from file_teacher import *
def login():
account = input('請輸入賬號:')
password = input('請輸入密碼:')
is_login = False
user = get_teacher_name()
if account in user.keys():
if password == user[account]:
is_login = True
print('登錄成功')
else:
print('登錄失敗,密碼錯誤')
else:
print('登錄失敗,該賬號沒有注冊')
index_login(is_login)
def register():
while True:
name = input('請輸入姓名(3-6位):')
if not 3 <= len(name) <= 6:
print('你輸入的姓名長度不符合要求')
elif get_teacher_name():
user = get_teacher_name()
if name in user.keys():
print('你輸入的名字已經(jīng)被注冊')
else:
break
else:
break
while True:
pwd = input('請輸入密碼(6-10位):')
if not 6 <= len(pwd) <= 10:
print('你輸入的密碼長度不符合要求')
else:
break
if file_register(name, pwd):
print('注冊成功')
index_login()
else:
print('注冊失敗')
def choose_menu():
choose_num = int(input('請選擇(1-3):'))
if choose_num == 1:
login()
elif choose_num == 2:
register()
elif choose_num == 3:
pass
else:
choose_menu()
def index_login(is_login=False) -> bool:
print(top)
print(top_2)
if is_login:
return True
else:
print(hint_1)
print(hint_2)
print(hint_3)
print(bottom)
choose_menu()
return False
index_login