modules.initdb(db)

select = input("1.注册\n2.登录\n3.退出\n")

while select != "1" and select != "2" and select != "3":
    print("请输入正确的选项!")
    select = input("1.注册\n2.登录\n3.退出\n")

if select == "3":
    quit()
elif select == "1":
    modules.regist(db)

while IS_LOG == False:
    USERNAME, IS_LOG, AUTH = modules.login(db)

print(USERNAME + " 登录成功!(" + AUTH + ")\n")


def judge(str):
    for i in range(0, len(str)):
        if ord(str[i]) < 48 or ord(str[i]) > 57:
            return False
    if int(str) <= 0:
        return False
    return True


while 1:
    if AUTH == "admin":
Beispiel #2
0
lg_title_lb = tk.Label(lg,
                       text="Kiddo Learn",
                       fg="orange",
                       bg=def_bg,
                       font="Helvetica 25 bold")
lg_username_lb = tk.Label(lg_form_fr, bg=def_bg, text="Username: "******"Password:  "******"Login",
    command=lambda: login(lg_username_ent, lg_password_ent, main))
lg_create_bt = tk.Button(lg,
                         text="Create New Account",
                         command=lambda: (lg.pack_forget(), display_crtacc()))


def display_lg():
    lg.pack(fill="both", expand=True)

    lg_title_lb.pack()

    lg_form_fr.pack(pady=5)

    lg_username_lb.grid(row=1, column=1)
    lg_username_ent.grid(row=1, column=2)
Beispiel #3
0
if __name__ == "__main__":
    string = upper_case('computer science')
    print(string)
    while True:
        print_welcome()
        option = get_user_option(1, 5)
        while option < 1 or option > 5:
            print("Invalid input. Try again")
            option = get_user_option(1, 5)
        if option == 1:  # Login
            if LOGGED_IN_USER.get("username", None):
                break
            username = input("Please enter a username: "******"Please enter a password: ")
            logged_in = login(username, password)
            if logged_in:
                # Show pending friend requests and allow user to accept or decline them
                has_requests = show_requests()
                break
            else:
                continue
        elif option == 2:  # Create new account
            registered = register()
            if not registered:
                exit()
            else:
                continue
        elif option == 3:
            print_useful_links()
            continue
 def check_login(self):
     authorized = login(self.entry_username, self.entry_password)
     if authorized:
         self.controller.show_frame(MainMenu)
     else:
         self.message_var.set("Invalid username and/or password")