mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-28 00:49:49 +03:00
final PasswordValidator class changes
This commit is contained in:
parent
701cf14693
commit
04af6e6198
|
@ -46,11 +46,11 @@ class PasswordValidator:
|
||||||
If the password is valid, return ``None``.
|
If the password is valid, return ``None``.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, validators=None, user=None):
|
def __init__(self, custom_validators=None, user=None):
|
||||||
self.validators = validators
|
self.validators = custom_validators
|
||||||
self.user = user
|
self.user = user
|
||||||
|
|
||||||
def __call__(self, value, serializer_field):
|
def __call__(self, value, *args, **kwargs):
|
||||||
try:
|
try:
|
||||||
password_validation.validate_password(
|
password_validation.validate_password(
|
||||||
password=value,
|
password=value,
|
||||||
|
@ -58,7 +58,7 @@ class PasswordValidator:
|
||||||
password_validators=self.validators
|
password_validators=self.validators
|
||||||
)
|
)
|
||||||
except ValidationError as e:
|
except ValidationError as e:
|
||||||
raise ValidationError(e)
|
raise e
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return '<%s(validators=%s)>' % (
|
return '<%s(validators=%s)>' % (
|
||||||
|
|
Loading…
Reference in New Issue
Block a user