mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-17 05:41:25 +02:00
add missing import for SSHA and add tests
This commit is contained in:
@@ -4,7 +4,7 @@ Advanced (ie. stronger) password hashers.
|
||||
This module relies on `passlib` to provide more secure hashers.
|
||||
"""
|
||||
|
||||
from passlib.hash import bcrypt, md5_crypt, sha256_crypt, sha512_crypt
|
||||
from passlib.hash import bcrypt, md5_crypt, sha256_crypt, sha512_crypt, ldap_salted_sha1
|
||||
|
||||
try:
|
||||
from argon2 import PasswordHasher as argon2_hasher
|
||||
|
||||
@@ -110,6 +110,12 @@ class AuthenticationTestCase(ModoTestCase):
|
||||
user.refresh_from_db()
|
||||
self.assertTrue(user.password.startswith("{SHA256}"))
|
||||
|
||||
self.client.logout()
|
||||
self.set_global_parameter("password_scheme", "ssha")
|
||||
self.client.post(reverse("core:login"), data)
|
||||
user.refresh_from_db()
|
||||
self.assertTrue(user.password.startswith("{SSHA}"))
|
||||
|
||||
if argon2 is not None:
|
||||
self.client.logout()
|
||||
self.set_global_parameter("password_scheme", "argon2id")
|
||||
@@ -176,7 +182,7 @@ class AuthenticationTestCase(ModoTestCase):
|
||||
"""Validate Dovecot supported schemes with fake command output."""
|
||||
exec_cmd_mock.return_value = (
|
||||
0,
|
||||
"MD5 MD5-CRYPT SHA SHA1 SHA256 SHA512 SMD5 SSHA SSHA256 SSHA512 "
|
||||
"MD5 MD5-CRYPT SHA SHA1 SSHA SHA256 SHA512 SMD5 SSHA SSHA256 SSHA512 "
|
||||
"PLAIN CLEAR CLEARTEXT PLAIN-TRUNC CRAM-MD5 SCRAM-SHA-1 HMAC-MD5 "
|
||||
"DIGEST-MD5 PLAIN-MD4 PLAIN-MD5 LDAP-MD5 LANMAN NTLM OTP SKEY RPA "
|
||||
"PBKDF2 CRYPT SHA256-CRYPT SHA512-CRYPT"
|
||||
@@ -187,6 +193,7 @@ class AuthenticationTestCase(ModoTestCase):
|
||||
"{MD5-CRYPT}",
|
||||
"{SHA}",
|
||||
"{SHA1}",
|
||||
"{SSHA}",
|
||||
"{SHA256}",
|
||||
"{SHA512}",
|
||||
"{SMD5}",
|
||||
|
||||
Reference in New Issue
Block a user