cubicweb/server/utils.py
changeset 12574 6ccf8fda063f
parent 12567 26744ad37953
equal deleted inserted replaced
12573:9b883489279f 12574:6ccf8fda063f
    49         return md5crypt(secret, self.salt.encode('ascii')).decode('utf-8')
    49         return md5crypt(secret, self.salt.encode('ascii')).decode('utf-8')
    50 
    50 
    51 
    51 
    52 _CRYPTO_CTX = CryptContext(['sha512_crypt', CustomMD5Crypt, 'des_crypt', 'ldap_salted_sha1'],
    52 _CRYPTO_CTX = CryptContext(['sha512_crypt', CustomMD5Crypt, 'des_crypt', 'ldap_salted_sha1'],
    53                            deprecated=['cubicwebmd5crypt', 'des_crypt'])
    53                            deprecated=['cubicwebmd5crypt', 'des_crypt'])
    54 # for bw compat with passlib < 1.7
    54 
    55 if not hasattr(_CRYPTO_CTX, 'hash'):
       
    56     _CRYPTO_CTX.hash = _CRYPTO_CTX.encrypt
       
    57 verify_and_update = _CRYPTO_CTX.verify_and_update
    55 verify_and_update = _CRYPTO_CTX.verify_and_update
    58 
    56 
    59 
    57 
    60 def crypt_password(passwd, salt=None):
    58 def crypt_password(passwd, salt=None):
    61     """return the encrypted password using the given salt or a generated one
    59     """return the encrypted password using the given salt or a generated one