mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-12-01 12:03:55 +01:00
Support for LDAP password modification (user level only for now). I need a working environment to check if postfix/dovecot accept the way I encrypt passwords.
see #192
This commit is contained in:
+3
-2
@@ -34,11 +34,12 @@ def _check_password(password, crypted):
|
||||
return hashlib.md5(password).hexdigest() == crypted
|
||||
return password
|
||||
|
||||
def crypt_password(password):
|
||||
def crypt_password(password, hexdigest=True):
|
||||
scheme = parameters.get_admin("PASSWORD_SCHEME", app="admin")
|
||||
if scheme == "crypt":
|
||||
salt = ''.join(Random().sample(string.letters + string.digits, 2))
|
||||
return crypt.crypt(password, salt)
|
||||
if scheme == "md5":
|
||||
return hashlib.md5(password).hexdigest()
|
||||
obj = hashlib.md5(password)
|
||||
return obj.hexdigest() if hexdigest else obj.digest()
|
||||
return password
|
||||
|
||||
Reference in New Issue
Block a user