As discussed in bug 1280152 comments, we should consider these as 2 separate issues, so this MP could start by dealing with the first one (the lazy password encryption issue).
For this part, your init() method looks fine, but there are already multiple instances of the salting+hashing dance. As you're adding one more, it seems a good opportunity to refactor a bit and extract that pattern into a private method, something like:
def _set_user_password(self, cr, uid, user_id, password, context=None):
password_hash = md5_crypt(password, gen_salt()) # TODO: update default algo in trunk
cr.execute("UPDATE res_users SET password='', password_crypt=%s WHERE id=%s", (password_hash, user_id))
Hi,
As discussed in bug 1280152 comments, we should consider these as 2 separate issues, so this MP could start by dealing with the first one (the lazy password encryption issue).
For this part, your init() method looks fine, but there are already multiple instances of the salting+hashing dance. As you're adding one more, it seems a good opportunity to refactor a bit and extract that pattern into a private method, something like:
def _set_user_ password( self, cr, uid, user_id, password, context=None): execute( "UPDATE res_users SET password='', password_crypt=%s WHERE id=%s",
(password_ hash, user_id))
password_hash = md5_crypt(password, gen_salt()) # TODO: update default algo in trunk
cr.
Thanks!