summaryrefslogtreecommitdiff
path: root/odoo/tools/config.py
diff options
context:
space:
mode:
authorXavier Morel <xmo@odoo.com>2020-01-29 12:08:31 +0000
committerXavier Morel <xmo@odoo.com>2020-02-04 12:42:35 +0000
commit672709c125dae6dfb1e8931b656c04993315cf4e (patch)
treede5707b6a339ef2b25cd303a4905ec1e8c4913b0 /odoo/tools/config.py
parentde590816d8d06730d99499db9a068f8d0e2cd3f9 (diff)
[FIX] core, base: CryptContext.encrypt is deprecated
However encrypt was marked as deprecated in the same version hash was added, so we need a conditional check to support <= 1.6.
Diffstat (limited to 'odoo/tools/config.py')
-rw-r--r--odoo/tools/config.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/odoo/tools/config.py b/odoo/tools/config.py
index 9401d94ecda..79978fd1d0c 100644
--- a/odoo/tools/config.py
+++ b/odoo/tools/config.py
@@ -694,7 +694,8 @@ class configmanager(object):
return os.path.join(self['data_dir'], 'filestore', dbname)
def set_admin_password(self, new_password):
- self.options['admin_passwd'] = crypt_context.encrypt(new_password)
+ hash_password = crypt_context.hash if hasattr(crypt_context, 'hash') else crypt_context.encrypt
+ self.options['admin_passwd'] = hash_password(new_password)
def verify_admin_password(self, password):
"""Verifies the super-admin password, possibly updating the stored hash if needed"""