diff --git a/modoboa/core/checks.py b/modoboa/core/checks.py index e487761b0..a1e6b7348 100644 --- a/modoboa/core/checks.py +++ b/modoboa/core/checks.py @@ -1,3 +1,4 @@ +from django.db.utils import ProgrammingError from django.core.checks import register, Info, Warning from django.conf import settings from django.utils.translation import gettext as _ @@ -50,7 +51,11 @@ def check_rsa_private_key_exists(app_configs, **kwargs): @register() def check_password_hasher(app_configs, **kwargs): msgs = [] - hasher = check_for_deprecated_password_schemes() + try: + hasher = check_for_deprecated_password_schemes() + except ProgrammingError: + # This is probably a fresh install... + return [] if hasher: msgs.append(W002) return msgs diff --git a/modoboa/core/password_hashers/__init__.py b/modoboa/core/password_hashers/__init__.py index 6127447d0..379732224 100644 --- a/modoboa/core/password_hashers/__init__.py +++ b/modoboa/core/password_hashers/__init__.py @@ -15,7 +15,6 @@ from modoboa.core.password_hashers.base import ( # NOQA:F401 SHA256Hasher, PasswordHasher, ) -from modoboa.parameters import tools as param_tools def get_password_hasher(scheme: str) -> type[PasswordHasher]: @@ -37,5 +36,7 @@ def get_password_hasher(scheme: str) -> type[PasswordHasher]: def get_configured_password_hasher() -> type[PasswordHasher]: """Retrieve the password hasher class currently configured.""" + from modoboa.parameters import tools as param_tools + scheme = param_tools.get_global_parameter("password_scheme") return get_password_hasher(scheme)