feat: address QA feedback and limit Checko collection
This commit is contained in:
@@ -13,6 +13,7 @@ from rest_framework.exceptions import ValidationError
|
||||
from rest_framework.permissions import AllowAny, IsAdminUser, IsAuthenticated
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.views import APIView
|
||||
from rest_framework_simplejwt.serializers import TokenRefreshSerializer
|
||||
from rest_framework_simplejwt.views import TokenRefreshView as SimpleJWTTokenRefreshView
|
||||
from rest_framework_simplejwt.views import TokenVerifyView as SimpleJWTTokenVerifyView
|
||||
|
||||
@@ -646,10 +647,20 @@ def user_profile_detail(request):
|
||||
return Response(profile_data)
|
||||
|
||||
|
||||
class ReusableTokenRefreshSerializer(TokenRefreshSerializer):
|
||||
"""Return the unchanged refresh token for concurrent frontend requests."""
|
||||
|
||||
def validate(self, attrs):
|
||||
payload = super().validate(attrs)
|
||||
payload["refresh"] = attrs["refresh"]
|
||||
return payload
|
||||
|
||||
|
||||
class TokenRefreshView(SimpleJWTTokenRefreshView):
|
||||
"""Обновление access токена через refresh токен."""
|
||||
|
||||
permission_classes = [AllowAny]
|
||||
serializer_class = ReusableTokenRefreshSerializer
|
||||
|
||||
@swagger_auto_schema(
|
||||
tags=[AUTH_TAG],
|
||||
|
||||
Reference in New Issue
Block a user