mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-17 05:41:25 +02:00
Merge pull request #3359 from modoboa/fix/make_check_work_fresh_install
Make check works also with fresh installs
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user