mirror of
https://github.com/Tivix/django-rest-auth.git
synced 2024-11-25 10:33:45 +03:00
Make signup honor AUTH_PASSWORD_VALIDATORS
This commit is contained in:
parent
479a40d2cc
commit
de0b2d5028
|
@ -1,3 +1,4 @@
|
|||
from django.core.exceptions import ValidationError as DjangoValidationError
|
||||
from django.http import HttpRequest
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.contrib.auth import get_user_model
|
||||
|
@ -207,7 +208,12 @@ class RegisterSerializer(serializers.Serializer):
|
|||
adapter = get_adapter()
|
||||
user = adapter.new_user(request)
|
||||
self.cleaned_data = self.get_cleaned_data()
|
||||
adapter.save_user(request, user, self)
|
||||
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)
|
||||
user.save()
|
||||
self.custom_signup(request, user)
|
||||
setup_user_email(request, user, [])
|
||||
return user
|
||||
|
|
Loading…
Reference in New Issue
Block a user