1
0
mirror of https://github.com/django/django.git synced 2025-10-25 14:46:09 +00:00

[5.2.x] Fixed #36179 -- Unhexed entries and removed duplicates in auth/common-passwords.txt.gz.

Backport of 727731d76d from main.
This commit is contained in:
mimi89999
2025-02-09 17:14:08 +01:00
committed by Sarah Boyce
parent ae391ca368
commit cb2ab4ee84
3 changed files with 10 additions and 1 deletions

View File

@@ -273,6 +273,15 @@ class CommonPasswordValidatorTest(SimpleTestCase):
CommonPasswordValidator().validate("godzilla")
self.assertEqual(cm.exception.messages, [expected_error])
def test_common_hexed_codes(self):
expected_error = "This password is too common."
common_hexed_passwords = ["asdfjkl:", "&#2336:"]
for password in common_hexed_passwords:
with self.subTest(password=password):
with self.assertRaises(ValidationError) as cm:
CommonPasswordValidator().validate(password)
self.assertEqual(cm.exception.messages, [expected_error])
def test_validate_custom_list(self):
path = os.path.join(
os.path.dirname(os.path.realpath(__file__)), "common-passwords-custom.txt"