mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-27 16:40:03 +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``.
|
||||
"""
|
||||
|
||||
def __init__(self, validators=None, user=None):
|
||||
self.validators = validators
|
||||
def __init__(self, custom_validators=None, user=None):
|
||||
self.validators = custom_validators
|
||||
self.user = user
|
||||
|
||||
def __call__(self, value, serializer_field):
|
||||
def __call__(self, value, *args, **kwargs):
|
||||
try:
|
||||
password_validation.validate_password(
|
||||
password=value,
|
||||
|
@ -58,7 +58,7 @@ class PasswordValidator:
|
|||
password_validators=self.validators
|
||||
)
|
||||
except ValidationError as e:
|
||||
raise ValidationError(e)
|
||||
raise e
|
||||
|
||||
def __repr__(self):
|
||||
return '<%s(validators=%s)>' % (
|
||||
|
|
Loading…
Reference in New Issue
Block a user