misc/migration/3.15.4_Any.py
author Rémi Cardona <remi.cardona@logilab.fr>
Fri, 13 Nov 2015 14:29:48 +0100
changeset 10895 90c55e27aa87
parent 8522 85b1c4b36d1d
child 10589 7c23b7de2b8d
permissions -rw-r--r--
[data] Use correct syntax to unset CSS attributes (closes #8602446) 'default' is actually a recognized CSS cursor name (the regular pointer). Using this value doesn't revert to whatever cursor DOM elements have by default ('pointer' on links, 'text' on text, etc). The proper way to unset a CSS attribute on DOM elements is to set it to an empty string. http://stackoverflow.com/questions/2027935/how-to-remove-css-property-using-javascript

from logilab.common.shellutils import generate_password
from cubicweb.server.utils import crypt_password

for user in rql('CWUser U WHERE U cw_source S, S name "system", U upassword P, U login L').entities():
    salt = user.upassword.getvalue()
    if crypt_password('', salt) == salt:
        passwd = generate_password()
        print 'setting random password for user %s' % user.login
        user.set_attributes(upassword=passwd)

commit()