mirror of
https://github.com/capricornxl/ad-password-self-service.git
synced 2025-08-12 04:50:36 +08:00
### 2021/05/19 -- 更新:
+ 添加了企业微信支持,修改pwdselfservice/local_settings.py中的SCAN_CODE_TYPE = 'DING'或SCAN_CODE_TYPE = 'WEWORK',区分使用哪个应用扫码验证 + 添加Reids缓存Token支持,如果不配置Redis则使用MemoryStorage缓存到内存中
This commit is contained in:
@@ -24,12 +24,22 @@ def format2username(account):
|
||||
elif re.fullmatch(domain_compile, account):
|
||||
return re.fullmatch(domain_compile, account).group(2)
|
||||
else:
|
||||
return account
|
||||
return account.lower()
|
||||
else:
|
||||
raise NameError("输入的账号不能为空..")
|
||||
|
||||
|
||||
def get_user_is_active(user_info):
|
||||
try:
|
||||
return True, user_info.get('active') or user_info.get('status')
|
||||
except Exception as e:
|
||||
return False, 'get_user_is_active: %s' % str(e)
|
||||
|
||||
except (KeyError, IndexError) as k_error:
|
||||
return False, 'get_user_is_active: %s' % str(k_error)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
user = 'aaa\jf.com'
|
||||
user = 'jf.com\XiangLe'
|
||||
username = format2username(user)
|
||||
print(username)
|
||||
|
Reference in New Issue
Block a user