Example #1
0
def login():

    print("login")
    if user_data["name"]:
        print("you have logined in")
        return

    count = 0
    while True:
        name = input("please input your name").strip()

        if name == 'q':
            break
        password = input("please input your password").strip()

        flg, msg = user.login_interface(name, password)

        if flg:
            user_data["name"] = name
            print(msg)
            break
        elif not flg and msg == "the name does not exist":
            print(msg)
        else:
            print(msg)
            count += 1
            if count == 3:
                user.lock_user_interface(name)
                print("the user has been locked")
                break
Example #2
0
def login():
    print("login")
    if user_data["name"]:
        print("have logied in")
        return 0
    else:
        count = 0
        while True:
            name = input("please input your name").strip()

            if name== 'q':
                break

            password = input("please input your password").strip()
            flag, msg = user.login_interface(name, password)
            if flag:
                user_data["name"] = name
                print(msg)
                break
            else:
                print(msg)
                count += 1
                if count == 3:
                    user.lock_user_interface(name)
                    print("the user has been locked")
                    break
Example #3
0
def login():
    while True:
        if users['status']:
            print('您已登陆,无需重复登陆!')
            return
        name = input('请输入用户名>>: ').strip()
        pwd = input('请输入用户密码>>: ').strip()
        user_dic = user.file(name)
        if not user_dic:
            print('该用户不存在')
            continue
        if user_dic['lock']:
            print('该用户已锁定')
            choice = input('退出请输入q>>: ').strip()
            if choice == 'q': break
            continue
        if pwd == user_dic['password']:
            print('登陆成功!')
            users['name'] = name
            users['status'] = True
            return
        count = 1
        while True:
            if count >= 3:
                print('用户已锁定')
                user.lock_user_interface(name)
                return
            count += 1
            print('密码不正确,请重新输入,%s次后将锁定!' % (3 - count))
            pwd = input('请输入用户密码>>: ').strip()
            if pwd == user_dic['password']:
                print('登陆成功!')
                users['name'] = name
                users['status'] = True
                return
Example #4
0
def login():
    if user_data['is_auth']:
        print('user is to')
        return
    count = 0
    while True:
        name = input('账号>>').strip()
        user_dic = user.get_userinfo_interfacen(name)
        if count == 3:
            user.lock_user_interface(name)
            print('账号已经锁定')
            break
        if user_dic:
            password = input('密码>>:').strip()
            if password == user_dic['password'] and not user_dic['locked']:
                print('登录成功')
                user_data['name'] = name
                user_data['is_auth'] = True
                break
            else:
                count += 1
                print('密码错误')
                break
        else:
            print('user is not  or  lock  ')
            continue
Example #5
0
def login():
    if user_data['is_auth']:
        print('user is login')
        return
    print('登陆')
    count = 0
    while True:

        name = input('please input your name').strip()

        #判断用户是否存在
        user_dic = user.get_userinfo_interface(name)
        if count == 3:
            user.lock_user_interface(name)
            print('user is locked')
            break

        if user_dic:
            password = input('please input your password').strip()
            if user_dic['password'] == password and not user_dic['locked']:
                print('login sucess')
                user_data['name'] = name
                user_data['is_auth'] = True
                break
            else:
                count += 1
                print('password error,or locked')
                continue
        else:
            print('user not exisit')
            continue
def login():
    print('登陆')
    if user_data['name']:
        print('您已经登陆了')
        return
    count = 0
    while True:
        name = input('请输入名字:').strip()
        if name == 'q': break
        password = input('请输入密码:').strip()
        flag, msg = user.login_interface(name, password)
        if flag:
            user_data['name'] = name
            print(msg)
            break
        else:
            print(msg)
            count += 1
            if count == 3:
                user.lock_user_interface(name)
                print('尝试过多,锁定')
                break
Example #7
0
def login():
    print('登录')
    if user_data['name']:
        print('已经登录')
        return
    count = 0  # 统计登录失败次数
    while True:
        name = input('请输入名字').strip()
        if name == 'q':
            break
        password = input('请输入密码').strip()
        flag, msg = user.login_interface(name, password)
        if flag:  # 如果登录成功
            user_data['name'] = name
            print(msg)
            break
        else:
            print(msg)
            count += 1
            if count == 3:  # 失败三次则锁定用户
                user.lock_user_interface(name)
                print('尝试过多,锁定用户')
                break