[FIX] base: on_change_login only set email for valid emails
authorChristophe Simonis <chs@openerp.com>
Sun, 24 Nov 2013 16:44:35 +0000 (17:44 +0100)
committerChristophe Simonis <chs@openerp.com>
Sun, 24 Nov 2013 16:44:35 +0000 (17:44 +0100)
bzr revid: chs@openerp.com-20131124164435-977xi3eg7svn5mgz

openerp/addons/base/res/res_users.py

index ba709a4..53cfe69 100644 (file)
@@ -167,7 +167,8 @@ class res_users(osv.osv):
     }
 
     def on_change_login(self, cr, uid, ids, login, context=None):
-        return {'value': {'email': login}}
+        v = {'email': login} if tools.single_email_re.match(login) else {}
+        return {'value': v}
 
     def on_change_company_id(self, cr, uid, ids, company_id):
         return {'warning' : {