diff options
| author | Quentin (OpenERP) <qdp-launchpad@openerp.com> | 2012-10-22 15:01:56 +0200 |
|---|---|---|
| committer | Quentin (OpenERP) <qdp-launchpad@openerp.com> | 2012-10-22 15:01:56 +0200 |
| commit | b2de4d421c0f7f9c36ecb9d71fdb81b5826a9dab (patch) | |
| tree | 02dc2fba43299bd5b69a408613af0277c94a6c64 /addons/base_crypt | |
| parent | c6eaa8beb8518abef184d84d074cec882980b8ca (diff) | |
| parent | 5b4fde2485f7c4f1b93dc1634c7929404fdcdaeb (diff) | |
[MERGE] merged a branch with several fixes, related to the new patch applied on server fo 1) osv/orm: call the fct_inv for functional fields that are stored=True 2) tools/yamp_import: on record creation, do not consider fields that wouldn't be returned by the client because readonly in the view
bzr revid: qdp-launchpad@openerp.com-20121022130156-ki47is4opjex9d79
Diffstat (limited to 'addons/base_crypt')
| -rw-r--r-- | addons/base_crypt/crypt.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/addons/base_crypt/crypt.py b/addons/base_crypt/crypt.py index 81a60a5dd5f..14e029eb988 100644 --- a/addons/base_crypt/crypt.py +++ b/addons/base_crypt/crypt.py @@ -140,18 +140,20 @@ class users(osv.osv): # Add handlers for 'input_pw' field. def set_pw(self, cr, uid, id, name, value, args, context): - if not value: - raise osv.except_osv(_('Error!'), _("You have to specify a password.")) + if value: + obj = pooler.get_pool(cr.dbname).get('res.users') + if not hasattr(obj, "_salt_cache"): + obj._salt_cache = {} - obj = pooler.get_pool(cr.dbname).get('res.users') - if not hasattr(obj, "_salt_cache"): - obj._salt_cache = {} + salt = obj._salt_cache[id] = gen_salt() + encrypted = encrypt_md5(value, salt) - salt = obj._salt_cache[id] = gen_salt() - encrypted = encrypt_md5(value, salt) + else: + #setting a password to '' is allowed. It can be used to inactivate the classic log-in of the user + #while the access can still be granted by another login method (openid...) + encrypted = '' cr.execute('update res_users set password=%s where id=%s', (encrypted.encode('utf-8'), int(id))) - cr.commit() del value def get_pw( self, cr, uid, ids, name, args, context ): |
