diff --git a/profiles/api/views.py b/profiles/api/views.py index fc83597..bd35944 100644 --- a/profiles/api/views.py +++ b/profiles/api/views.py @@ -54,7 +54,7 @@ SubQuestion, SubQuestionCondition, ) -from profiles.utils import generate_password, get_user_result +from profiles.utils import encrypt_text, generate_password, get_user_result from .utils import PostalCodeResultFilter @@ -187,7 +187,6 @@ def list(self, request, *args, **kwargs): permission_classes=[AllowAny], ) def start_poll(self, request): - # TODO check recaptha uuid4 = uuid.uuid4() username = f"anonymous_{str(uuid4)}" user = User.objects.create(pk=uuid4, username=username, is_generated=True) @@ -196,7 +195,8 @@ def start_poll(self, request): user.profile = Profile.objects.create(user=user) user.save() token, _ = Token.objects.get_or_create(user=user) - response_data = {"token": token.key, "id": user.id} + data = encrypt_text(token.key, settings.TOKEN_SECRET) + response_data = {"data": data, "id": user.id} return Response(response_data, status=status.HTTP_200_OK) @extend_schema(