mirror of
https://github.com/capricornxl/ad-password-self-service.git
synced 2025-08-11 16:20:10 +08:00
修改format2username方法,返回元组作为结果判断。
悠resetpwd.views 将所有format2username兼容处理,防止当用户名为空时,能正确抛出异常给前端页面。 修复resetpwd.views callback_check中一个BUG(如果用户不存在或未激活,会存在通过format2username拿不到用户名的情况,在这里就直接抛出user_info整个json)
This commit is contained in:
@@ -20,13 +20,13 @@ def format2username(account):
|
||||
domain_compile = re.compile(r'(.*)\\(.*)')
|
||||
|
||||
if re.fullmatch(mail_compile, account):
|
||||
return re.fullmatch(mail_compile, account).group(1)
|
||||
return True, re.fullmatch(mail_compile, account).group(1)
|
||||
elif re.fullmatch(domain_compile, account):
|
||||
return re.fullmatch(domain_compile, account).group(2)
|
||||
return True, re.fullmatch(domain_compile, account).group(2)
|
||||
else:
|
||||
return account.lower()
|
||||
return True, account.lower()
|
||||
else:
|
||||
raise NameError("输入的账号不能为空..")
|
||||
return False, NameError("{}格式化失败,注意:account用户账号是邮箱或DOMAIN\\username或username格式!".format(account))
|
||||
|
||||
|
||||
def get_user_is_active(user_info):
|
||||
|
Reference in New Issue
Block a user