1
0
mirror of https://github.com/etesync/server synced 2024-11-22 08:48:07 +00:00

Signup: send a signal on account signup.

This commit is contained in:
Tom Hacohen 2020-09-02 12:54:27 +03:00
parent 42a72ce5c7
commit 43569727f4
3 changed files with 6 additions and 1 deletions

View File

@ -462,7 +462,6 @@ class AuthenticationSignupSerializer(BetterErrorsMixin, serializers.Serializer):
instance.clean_fields()
except django_exceptions.ValidationError as e:
self.transform_validation_error("user", e)
# FIXME: send email verification
models.UserInfo.objects.create(**validated_data, owner=instance)

View File

@ -0,0 +1,3 @@
from django.dispatch import Signal
user_signed_up = Signal(providing_args=['request', 'user'])

View File

@ -74,6 +74,7 @@ from .serializers import (
from .utils import get_user_queryset
from .exceptions import EtebaseValidationError
from .parsers import ChunkUploadParser
from .signals import user_signed_up
User = get_user_model()
@ -646,6 +647,8 @@ class AuthenticationViewSet(viewsets.ViewSet):
serializer.is_valid(raise_exception=True)
user = serializer.save()
user_signed_up.send(sender=user.__class__, request=request, user=user)
data = self.login_response_data(user)
return Response(data, status=status.HTTP_201_CREATED)