fix: Password reset is only required for AUTH_BACKEND_MODEL

This commit is contained in:
wangruidong
2024-09-18 18:09:21 +08:00
committed by Bryan
parent e373a79d63
commit 3dde80a60a
2 changed files with 14 additions and 3 deletions

View File

@@ -233,13 +233,17 @@ class AuthMixin:
return True
return False
def check_passwd_too_simple(self, password):
backend = getattr(self, 'backend', None)
@staticmethod
def check_passwd_too_simple(password):
simple_passwords = ['admin', 'ChangeMe']
if backend == settings.AUTH_BACKEND_MODEL and password in simple_passwords:
if password in simple_passwords:
return True
return False
def is_auth_backend_model(self):
backend = getattr(self, 'backend', None)
return backend == settings.AUTH_BACKEND_MODEL
@staticmethod
def get_public_key_md5(key):
try: