cubicweb/misc/migration/3.15.4_Any.py
changeset 11057 0b59724cb3f2
parent 10589 7c23b7de2b8d
equal deleted inserted replaced
11052:058bb3dc685f 11057:0b59724cb3f2
       
     1 from __future__ import print_function
       
     2 
       
     3 from logilab.common.shellutils import generate_password
       
     4 from cubicweb.server.utils import crypt_password
       
     5 
       
     6 for user in rql('CWUser U WHERE U cw_source S, S name "system", U upassword P, U login L').entities():
       
     7     salt = user.upassword.getvalue()
       
     8     if crypt_password('', salt) == salt:
       
     9         passwd = generate_password()
       
    10         print('setting random password for user %s' % user.login)
       
    11         user.set_attributes(upassword=passwd)
       
    12 
       
    13 commit()