diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py index a264253b7..e08516d3f 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -76,7 +76,7 @@ AUTH_PASSWORD_VALIDATORS = getattr(configuration, 'AUTH_PASSWORD_VALIDATORS', [ "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator", }, { - "NAME": "utilities.password_validation.NumericAlphaPasswordValidator", + "NAME": "utilities.password_validation.AlphanumericPasswordValidator", }, ]) BASE_PATH = trailing_slash(getattr(configuration, 'BASE_PATH', '')) diff --git a/netbox/users/tests/test_api.py b/netbox/users/tests/test_api.py index 63d3e1ff7..71496f007 100644 --- a/netbox/users/tests/test_api.py +++ b/netbox/users/tests/test_api.py @@ -90,23 +90,10 @@ class UserTest(APIViewTestCases.APIViewTestCase): user.refresh_from_db() self.assertTrue(user.check_password(data['password'])) - @override_settings(AUTH_PASSWORD_VALIDATORS=[ - { - "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator", - }, - { - "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator", - "OPTIONS": { - "min_length": 8, - }, - }, - { - "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator", - }, - { - "NAME": "utilities.password_validation.NumericAlphaPasswordValidator", - }, - ]) + @override_settings(AUTH_PASSWORD_VALIDATORS=[{ + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + 'OPTIONS': {'min_length': 8} + }]) def test_password_validation_enforced(self): """ Test that any configured password validation rules (AUTH_PASSWORD_VALIDATORS) are enforced. diff --git a/netbox/users/tests/test_views.py b/netbox/users/tests/test_views.py index 1b4d821f8..86da7dda2 100644 --- a/netbox/users/tests/test_views.py +++ b/netbox/users/tests/test_views.py @@ -60,23 +60,6 @@ class UserTestCase( 'last_name': 'newlastname', } - @override_settings(AUTH_PASSWORD_VALIDATORS=[ - { - "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator", - }, - { - "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator", - "OPTIONS": { - "min_length": 8, - }, - }, - { - "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator", - }, - { - "NAME": "utilities.password_validation.NumericAlphaPasswordValidator", - }, - ]) def test_password_validation_enforced(self): """ Test that any configured password validation rules (AUTH_PASSWORD_VALIDATORS) are enforced. @@ -97,8 +80,8 @@ class UserTestCase( self.assertHttpStatus(response, 200) # Password long enough - data['password'] = 'fooBar12' - data['confirm_password'] = 'fooBar12' + data['password'] = 'fooBarFoo123' + data['confirm_password'] = 'fooBarFoo123' self.assertHttpStatus(self.client.post(**request), 302) # Password no number diff --git a/netbox/utilities/password_validation.py b/netbox/utilities/password_validation.py index ff34e7932..9094c4c7e 100644 --- a/netbox/utilities/password_validation.py +++ b/netbox/utilities/password_validation.py @@ -2,7 +2,7 @@ from django.core.exceptions import ValidationError from django.utils.translation import gettext as _ -class NumericAlphaPasswordValidator: +class AlphanumericPasswordValidator: """ Validate that the password has at least one numeral, one uppercase letter and one lowercase letter. """