1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-01 08:26:03 +00:00

fix(settings): new passwords pass Django's password validators

AUTH_PASSWORD_VALIDATORS was unset, so the user forms and the password
change accepted any password, a one-letter one included. The template
now sets Django's four standard validators: at least 8 characters, not
a common password, not only digits, not like the user's name or e-mail.
The tests that set weak passwords use ones the validators accept.
This commit is contained in:
catborise 2026-11-06 11:01:43 +03:00
parent 0ccdb2adb7
commit 5b2542c6ed
4 changed files with 14 additions and 7 deletions

View file

@ -177,6 +177,13 @@ AUTHENTICATION_BACKENDS = [
#"django_auth_ldap.backend.LDAPBackend",
]
AUTH_PASSWORD_VALIDATORS = [
{"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator"},
{"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator"},
{"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator"},
{"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator"},
]
LOGIN_URL = "/accounts/login/"
# Tests create users by the thousand: a fast hash for them (manage.py test only)