mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
User-add random password support
I've used code from ipalib/plugins/host.py to add support for random password generation. The '--random' option is now available in user-add and user-mod commands. If both the 'password' and 'random' options are used the 'random' option will be ignored. Two test cases were added to unit test's module test_user_plugin.py - they test creating and modifying user with random password. Two fuzzy tests were added: test for password(string that doesn't start or end with whitespace and doesn't containt other whitespace than ' ') and for whatever string(because of krbextradata). I've slightly modified ipa_generate_password in order to make passwords for users more user-friendly(reduce number of non-letters). It has two optional parameters now - first one is string of characters that should be used for generating the passwd and second one is length of password. If none parameter is set default values will be used so there's no need to modify other plugins that use random password generator. https://fedorahosted.org/freeipa/ticket/1979
This commit is contained in:
committed by
Rob Crittenden
parent
7710bfb5bd
commit
da4b4fc4d9
@@ -53,6 +53,16 @@ fuzzy_date = Fuzzy('^[a-zA-Z]{3} [a-zA-Z]{3} \d{2} \d{2}:\d{2}:\d{2} \d{4} UTC$'
|
||||
|
||||
fuzzy_issuer = Fuzzy(type=basestring, test=lambda issuer: valid_issuer(issuer, api.env.realm))
|
||||
|
||||
# Matches password - password consists of all printable characters without whitespaces
|
||||
# The only exception is space, but space cannot be at the beggingin or end of the pwd
|
||||
fuzzy_password = Fuzzy('^\S([\S ]*\S)*$')
|
||||
|
||||
# Matches generalized time value. Time format is: %Y%m%d%H%M%SZ
|
||||
fuzzy_dergeneralizedtime = Fuzzy('^[0-9]{14}Z$')
|
||||
|
||||
# match any string
|
||||
fuzzy_string = Fuzzy(type=basestring)
|
||||
|
||||
try:
|
||||
if not api.Backend.xmlclient.isconnected():
|
||||
api.Backend.xmlclient.connect(fallback=False)
|
||||
|
||||
Reference in New Issue
Block a user