branch | stable |
changeset 8522 | 85b1c4b36d1d |
child 10589 | 7c23b7de2b8d |
8521:dfdffebce8a4 | 8522:85b1c4b36d1d |
---|---|
1 from logilab.common.shellutils import generate_password |
|
2 from cubicweb.server.utils import crypt_password |
|
3 |
|
4 for user in rql('CWUser U WHERE U cw_source S, S name "system", U upassword P, U login L').entities(): |
|
5 salt = user.upassword.getvalue() |
|
6 if crypt_password('', salt) == salt: |
|
7 passwd = generate_password() |
|
8 print 'setting random password for user %s' % user.login |
|
9 user.set_attributes(upassword=passwd) |
|
10 |
|
11 commit() |