def login(): global USER print('\033[32m登陆\033[0m') while True: name = input('登陆用户名 >>: ').strip() if name == 'q': break password = input('登陆密码 >>: ').strip() flag, msg = user.login(name, password) if flag: USER = name print('\033[32m%s\033[0m' % msg) return else: print('\033[31m%s\033[0m' % msg)
def login(): global CURRENT_USER print('\033[32m登陆\033[0m') while True: name = input_string('用户名') if name == 'q': break password = input_string('密码') if password == 'q': break flag, msg = user.login(name, password) if flag: CURRENT_USER = name print('\033[32m%s\033[0m' % msg) return else: print('\033[31m%s\033[0m' % msg)
def login(): print('登录') if user_data['name']: print('您已经登录') return error_coutn = 0 while True: name = input('请输入用户名:') if name == 'q': break password = input('请输入密码:') flag, msg = user.login(name, password) if flag: user_data['name'] = name print(msg) break else: print(msg) error_coutn += 1 if error_coutn > 3: user.lock_user(name) print('尝试太多,用户锁定') break
def login(): logger = comment.get_logger("登陆") while True: input_name = input("请输入你的用户名:").strip() flag = user.check_username(input_name) if not flag: print("用户名不存在!请重新输入!") continue ret = user.check_lock(input_name) if ret: print("账户被锁定!") logger.debug("{}尝试登陆,账号被锁定,登陆失败!".format(input_name)) return input_pwd = input("请输入密码:").strip() res = user.login(input_name, input_pwd) if not res: print("密码不正确,请重新输入!") logger.debug("{}尝试登陆,密码输入错误,登陆失败!".format(input_name)) continue user_info["user"] = input_name logger.debug("{}登陆成功!".format(input_name)) print("登陆成功!") return