diff --git a/django/contrib/auth/password_validation.py b/django/contrib/auth/password_validation.py
index 690be58700..d1302fb07d 100644
|
a
|
b
|
class UserAttributeSimilarityValidator:
|
| 197 | 197 | ): |
| 198 | 198 | continue |
| 199 | 199 | if ( |
| 200 | | SequenceMatcher(a=password, b=value_part).quick_ratio() |
| | 200 | (matcher := SequenceMatcher(a=password, b=value_part)).quick_ratio() |
| 201 | 201 | >= self.max_similarity |
| 202 | | ): |
| | 202 | ) and matcher.ratio() >= self.max_similarity: |
| 203 | 203 | try: |
| 204 | 204 | verbose_name = str( |
| 205 | 205 | user._meta.get_field(attribute_name).verbose_name |
diff --git a/tests/auth_tests/test_validators.py b/tests/auth_tests/test_validators.py
index 3ce2611633..024bb5aa02 100644
|
a
|
b
|
class UserAttributeSimilarityValidatorTest(TestCase):
|
| 231 | 231 | ) |
| 232 | 232 | ) |
| 233 | 233 | |
| | 234 | user.anagram = "mountaineers" |
| | 235 | self.assertIsNone( |
| | 236 | UserAttributeSimilarityValidator(user_attributes=["anagram"]).validate( |
| | 237 | "enumerations", user=user |
| | 238 | ) |
| | 239 | ) |
| | 240 | |
| 234 | 241 | @isolate_apps("auth_tests") |
| 235 | 242 | def test_validate_property(self): |
| 236 | 243 | class TestUser(models.Model): |