Commit 4bcd799b authored by Rafael Monnerat's avatar Rafael Monnerat Committed by Thomas Gambier

slapos_subscription_request: Generate a password that always comply with the Authentication Policy

The password is re-set anyway later, however it is required to comply to Authentication Policy, generating an acceptable value.
parent 70995f5e
......@@ -23,13 +23,20 @@ person = portal.person_module.newContent(
portal_type="Person",
first_name=name)
password = [random.choice(string.upper(string.ascii_letters)),
random.choice(string.lower(string.ascii_letters)),
random.choice(string.digits),
random.choice("$!*#%$.;:,")]
chars = string.ascii_letters + string.digits + '!@#$%^&*()'
password.extend([random.choice(chars) for _ in range(26)])
random.shuffle(password)
login = person.newContent(
portal_type="ERP5 Login",
reference=person.getUserId(),
# Please generate a LAAARGE random password.
password=''.join(random.choice(chars) for i in range(13)))
password=''.join(password))
login.validate()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment