mirror of
https://github.com/ansible/awx.git
synced 2026-07-05 05:18:02 -02:30
Adding basic validation for local passwords (#13789)
* Adding basic validation for local passwords * Adding edit screen * Fixing tests
This commit is contained in:
@@ -1603,6 +1603,50 @@ register(
|
||||
],
|
||||
)
|
||||
|
||||
register(
|
||||
'LOCAL_PASSWORD_MIN_LENGTH',
|
||||
field_class=fields.IntegerField,
|
||||
min_value=0,
|
||||
default=0,
|
||||
label=_('Minimum number of characters in local password'),
|
||||
help_text=_('Minimum number of characters required in a local password. 0 means no minimum'),
|
||||
category=_('Authentication'),
|
||||
category_slug='authentication',
|
||||
)
|
||||
|
||||
register(
|
||||
'LOCAL_PASSWORD_MIN_DIGITS',
|
||||
field_class=fields.IntegerField,
|
||||
min_value=0,
|
||||
default=0,
|
||||
label=_('Minimum number of digit characters in local password'),
|
||||
help_text=_('Minimum number of digit characters required in a local password. 0 means no minimum'),
|
||||
category=_('Authentication'),
|
||||
category_slug='authentication',
|
||||
)
|
||||
|
||||
register(
|
||||
'LOCAL_PASSWORD_MIN_UPPER',
|
||||
field_class=fields.IntegerField,
|
||||
min_value=0,
|
||||
default=0,
|
||||
label=_('Minimum number of uppercase characters in local password'),
|
||||
help_text=_('Minimum number of uppercase characters required in a local password. 0 means no minimum'),
|
||||
category=_('Authentication'),
|
||||
category_slug='authentication',
|
||||
)
|
||||
|
||||
register(
|
||||
'LOCAL_PASSWORD_MIN_SPECIAL',
|
||||
field_class=fields.IntegerField,
|
||||
min_value=0,
|
||||
default=0,
|
||||
label=_('Minimum number of special characters in local password'),
|
||||
help_text=_('Minimum number of special characters required in a local password. 0 means no minimum'),
|
||||
category=_('Authentication'),
|
||||
category_slug='authentication',
|
||||
)
|
||||
|
||||
|
||||
def tacacs_validate(serializer, attrs):
|
||||
if not serializer.instance or not hasattr(serializer.instance, 'TACACSPLUS_HOST') or not hasattr(serializer.instance, 'TACACSPLUS_SECRET'):
|
||||
|
||||
Reference in New Issue
Block a user