mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-23 06:38:40 +02:00
Improve code quality
This commit is contained in:
@@ -48,8 +48,8 @@ class GeneralParametersForm(param_forms.AdminParametersForm):
|
||||
password_scheme = forms.ChoiceField(
|
||||
label=ugettext_lazy("Default password scheme"),
|
||||
choices=[(hasher.name, ugettext_lazy(hasher.label))
|
||||
for hasher in PasswordHasher.get_password_hashers()
|
||||
if hasher().scheme in get_dovecot_schemes()],
|
||||
for hasher in PasswordHasher.get_password_hashers()
|
||||
if hasher().scheme in get_dovecot_schemes()],
|
||||
initial="sha512crypt",
|
||||
help_text=ugettext_lazy("Scheme used to crypt mailbox passwords"),
|
||||
widget=forms.Select(attrs={"class": "form-control"})
|
||||
|
||||
@@ -53,6 +53,7 @@ def get_dovecot_schemes():
|
||||
except OSError:
|
||||
pass
|
||||
else:
|
||||
supported_schemes = ["{{{}}}".format(scheme) for scheme in force_text(schemes).split()]
|
||||
supported_schemes = ["{{{}}}".format(scheme)
|
||||
for scheme in force_text(schemes).split()]
|
||||
|
||||
return supported_schemes
|
||||
|
||||
@@ -70,6 +70,7 @@ class PasswordHasher(object):
|
||||
|
||||
@classmethod
|
||||
def get_password_hashers(cls):
|
||||
"""Return all the PasswordHasher supported by Modoboa"""
|
||||
return cls.__subclasses__()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user