[server] Use CryptContext's hash method instead of deprecated encrypt method
authorDenis Laxalde <denis.laxalde@logilab.fr>
Wed, 07 Dec 2016 14:11:23 +0100
changeset 11880 bc9d901cb9e6
parent 11878 e42cb31e9301
child 11884 6186cd15a46d
[server] Use CryptContext's hash method instead of deprecated encrypt method Getting rid of the following deprecation warning: :: the method passlib.context.CryptContext.encrypt() is deprecated as of Passlib 1.7, and will be removed in Passlib 2.0, use CryptContext.hash() instead.
cubicweb/server/utils.py
--- a/cubicweb/server/utils.py	Thu Oct 22 16:58:12 2015 +0200
+++ b/cubicweb/server/utils.py	Wed Dec 07 14:11:23 2016 +0100
@@ -66,7 +66,7 @@
     """return the encrypted password using the given salt or a generated one
     """
     if salt is None:
-        return _CRYPTO_CTX.encrypt(passwd).encode('ascii')
+        return _CRYPTO_CTX.hash(passwd).encode('ascii')
     # empty hash, accept any password for backwards compat
     if salt == '':
         return salt