Fix PasswordType
This commit fixes an error when hex_md5 and other schemes that does not have max_salt_size. This kind of schemes are needed to migrate from very old and stupid databases.
This commit is contained in:
@@ -143,7 +143,7 @@ class PasswordType(types.TypeDecorator, ScalarCoercible):
|
|||||||
scheme = getattr(__import__('passlib.hash').hash, name)
|
scheme = getattr(__import__('passlib.hash').hash, name)
|
||||||
length = 4 + len(scheme.name)
|
length = 4 + len(scheme.name)
|
||||||
length += len(str(getattr(scheme, 'max_rounds', '')))
|
length += len(str(getattr(scheme, 'max_rounds', '')))
|
||||||
length += scheme.max_salt_size or 0
|
length += getattr(scheme, 'max_salt_size', 0)
|
||||||
length += getattr(
|
length += getattr(
|
||||||
scheme,
|
scheme,
|
||||||
'encoded_checksum_size',
|
'encoded_checksum_size',
|
||||||
|
@@ -16,10 +16,11 @@ class TestPasswordType(TestCase):
|
|||||||
schemes=[
|
schemes=[
|
||||||
'pbkdf2_sha512',
|
'pbkdf2_sha512',
|
||||||
'pbkdf2_sha256',
|
'pbkdf2_sha256',
|
||||||
'md5_crypt'
|
'md5_crypt',
|
||||||
|
'hex_md5'
|
||||||
],
|
],
|
||||||
|
|
||||||
deprecated=['md5_crypt']
|
deprecated=['md5_crypt', 'hex_md5']
|
||||||
))
|
))
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
Reference in New Issue
Block a user