diff --git a/odoo/addons/base/models/res_users.py b/odoo/addons/base/models/res_users.py index 22e73042883..45b5c96ed52 100644 --- a/odoo/addons/base/models/res_users.py +++ b/odoo/addons/base/models/res_users.py @@ -296,8 +296,9 @@ class Users(models.Model): def _set_password(self): ctx = self._crypt_context() + hash_password = ctx.hash if hasattr(ctx, 'hash') else ctx.encrypt for user in self: - self._set_encrypted_password(user.id, ctx.encrypt(user.password)) + self._set_encrypted_password(user.id, hash_password(user.password)) def _set_encrypted_password(self, uid, pw): assert self._crypt_context().identify(pw) != 'plaintext' 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"""