perf: user_can_authenticate add logger

This commit is contained in:
feng
2025-10-14 15:33:51 +08:00
committed by feng626
parent 098f0950cb
commit 92e250e03b

View File

@@ -25,7 +25,10 @@ class JMSBaseAuthBackend:
"""
# 三方用户认证完成后,在后续的 get_user 获取逻辑中,也应该需要检查用户是否有效
is_valid = getattr(user, 'is_valid', None)
return is_valid or is_valid is None
if not is_valid:
logger.info("User %s is not valid", getattr(user, "username", "<unknown>"))
return False
return True
# allow user to authenticate
def username_allow_authenticate(self, username):