mirror of
https://github.com/Tivix/django-rest-auth.git
synced 2024-11-22 00:56:34 +03:00
Add as_serializer_error for consistent error messages
This commit is contained in:
parent
c0d3debe4c
commit
8f47bc9d14
|
@ -211,8 +211,10 @@ class RegisterSerializer(serializers.Serializer):
|
|||
user = adapter.save_user(request, user, self, commit=False)
|
||||
try:
|
||||
adapter.clean_password(self.cleaned_data['password1'], user=user)
|
||||
except DjangoValidationError as e:
|
||||
raise serializers.ValidationError(e.messages)
|
||||
except DjangoValidationError as exc:
|
||||
raise serializers.ValidationError(
|
||||
detail=serializers.as_serializer_error(exc)
|
||||
)
|
||||
user.save()
|
||||
self.custom_signup(request, user)
|
||||
setup_user_email(request, user, [])
|
||||
|
|
Loading…
Reference in New Issue
Block a user