equal
deleted
inserted
replaced
|
1 from __future__ import print_function |
|
2 |
1 from logilab.common.shellutils import generate_password |
3 from logilab.common.shellutils import generate_password |
2 from cubicweb.server.utils import crypt_password |
4 from cubicweb.server.utils import crypt_password |
3 |
5 |
4 for user in rql('CWUser U WHERE U cw_source S, S name "system", U upassword P, U login L').entities(): |
6 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() |
7 salt = user.upassword.getvalue() |
6 if crypt_password('', salt) == salt: |
8 if crypt_password('', salt) == salt: |
7 passwd = generate_password() |
9 passwd = generate_password() |
8 print 'setting random password for user %s' % user.login |
10 print('setting random password for user %s' % user.login) |
9 user.set_attributes(upassword=passwd) |
11 user.set_attributes(upassword=passwd) |
10 |
12 |
11 commit() |
13 commit() |