server/utils.py
branchstable
changeset 8546 3d2038d6f20d
parent 8446 cae198371548
child 8550 63260486de89
equal deleted inserted replaced
8545:eb7a171cec72 8546:3d2038d6f20d
    50     # passlib 1.5 wants calc_checksum, 1.6 wants _calc_checksum
    50     # passlib 1.5 wants calc_checksum, 1.6 wants _calc_checksum
    51     def calc_checksum(self, secret):
    51     def calc_checksum(self, secret):
    52         return md5crypt(secret, self.salt.encode('ascii')).decode('utf-8')
    52         return md5crypt(secret, self.salt.encode('ascii')).decode('utf-8')
    53     _calc_checksum = calc_checksum
    53     _calc_checksum = calc_checksum
    54 
    54 
    55 _CRYPTO_CTX = CryptContext(['sha512_crypt', CustomMD5Crypt, 'des_crypt', 'ldap_salted_sha1'])
    55 _CRYPTO_CTX = CryptContext(['sha512_crypt', CustomMD5Crypt, 'des_crypt', 'ldap_salted_sha1'],
       
    56                            deprecated=['cubicwebmd5crypt', 'des_crypt'])
       
    57 verify_and_update = _CRYPTO_CTX.verify_and_update
    56 
    58 
    57 def crypt_password(passwd, salt=None):
    59 def crypt_password(passwd, salt=None):
    58     """return the encrypted password using the given salt or a generated one
    60     """return the encrypted password using the given salt or a generated one
    59     """
    61     """
    60     if salt is None:
    62     if salt is None: