include punctuation in random passwords

This commit is contained in:
Jay Lee
2019-05-29 19:19:25 -04:00
parent 7b70c5a745
commit dc678dd510

View File

@@ -7497,7 +7497,8 @@ def getUserAttributes(i, cd, updateCmd):
systemErrorExit(2, '%s is not a valid argument for "gam %s user"' % (sys.argv[i], ['create', 'update'][updateCmd]))
if need_password:
rnd = SystemRandom()
body['password'] = ''.join(rnd.choice(string.digits+string.ascii_letters) for _ in range(100))
valid_chars = string.digits+string.ascii_letters+string.punctuation
body['password'] = ''.join(rnd.choice(valid_chars) for _ in range(100))
if 'password' in body and need_to_hash_password:
body['password'] = gen_sha512_hash(body['password'])
body['hashFunction'] = 'crypt'