Add initial implementations for forms and organization apps with serializers, factories, and admin configurations
Some checks failed
CI/CD Pipeline / Run Tests (push) Failing after 45s
CI/CD Pipeline / Code Quality Checks (push) Failing after 48s
CI/CD Pipeline / Build Docker Images (push) Has been skipped
CI/CD Pipeline / Push to Gitea Registry (push) Has been skipped
CI/CD Pipeline / Deploy to Server (push) Has been skipped

This commit is contained in:
2026-03-28 18:23:06 +01:00
parent 8ed3e1175c
commit 345b1d0cc8
201 changed files with 15097 additions and 6691 deletions

View File

@@ -8,6 +8,7 @@ from rest_framework.permissions import AllowAny, IsAuthenticated
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework_simplejwt.tokens import RefreshToken
from .serializers import (
LoginSerializer,
PasswordChangeSerializer,
@@ -71,17 +72,17 @@ class LoginView(APIView):
@swagger_auto_schema(
tags=[AUTH_TAG],
operation_summary="Вход",
operation_description="Аутентификация по email и паролю. Возвращает JWT токены.",
operation_description="Аутентификация по логину и паролю. Возвращает JWT токены.",
request_body=LoginSerializer,
responses={200: TokenSerializer},
)
def post(self, request):
serializer = LoginSerializer(data=request.data)
if serializer.is_valid():
email = serializer.validated_data["email"]
username = serializer.validated_data["username"]
password = serializer.validated_data["password"]
user = authenticate(email=email, password=password)
user = authenticate(username=username, password=password)
if user:
tokens = UserService.get_tokens_for_user(user)
return Response(tokens, status=status.HTTP_200_OK)