MCPcopy
hub / github.com/django/django / validate_password

Function validate_password

django/contrib/auth/password_validation.py:41–57  ·  view source on GitHub ↗

Validate that the password meets all validator requirements. If the password is valid, return ``None``. If the password is invalid, raise ValidationError with all error messages.

(password, user=None, password_validators=None)

Source from the content-addressed store, hash-verified

39
40
41def validate_password(password, user=None, password_validators=None):
42 """
43 Validate that the password meets all validator requirements.
44
45 If the password is valid, return ``None``.
46 If the password is invalid, raise ValidationError with all error messages.
47 """
48 errors = []
49 if password_validators is None:
50 password_validators = get_default_password_validators()
51 for validator in password_validators:
52 try:
53 validator.validate(password, user)
54 except ValidationError as error:
55 errors.append(error)
56 if errors:
57 raise ValidationError(errors)
58
59
60def password_changed(password, user=None, password_validators=None):

Callers 3

handleMethod · 0.90
handleMethod · 0.90

Calls 4

ValidationErrorClass · 0.90
validateMethod · 0.45
appendMethod · 0.45

Tested by 1