jwt changes
This commit is contained in:
parent
edd9b25545
commit
ff3273a366
@ -10,7 +10,7 @@ For the full list of settings and their values, see
|
|||||||
https://docs.djangoproject.com/en/5.1/ref/settings/
|
https://docs.djangoproject.com/en/5.1/ref/settings/
|
||||||
"""
|
"""
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from datetime import timedelta
|
||||||
from decouple import config
|
from decouple import config
|
||||||
|
|
||||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||||
@ -145,3 +145,10 @@ SPECTACULAR_SETTINGS = {
|
|||||||
CORS_ALLOWED_ORIGINS = [
|
CORS_ALLOWED_ORIGINS = [
|
||||||
"http://localhost:5173", # Remplace par l'URL de ton front-end
|
"http://localhost:5173", # Remplace par l'URL de ton front-end
|
||||||
]
|
]
|
||||||
|
CORS_ALLOW_CREDENTIALS = True
|
||||||
|
|
||||||
|
SIMPLE_JWT = {
|
||||||
|
'ACCESS_TOKEN_LIFETIME': timedelta(minutes=5),
|
||||||
|
'REFRESH_TOKEN_LIFETIME': timedelta(days=1),
|
||||||
|
'ROTATE_REFRESH_TOKENS': True,
|
||||||
|
'BLACKLIST_AFTER_ROTATION': True,}
|
@ -33,12 +33,12 @@ class CreateUser(generics.CreateAPIView):
|
|||||||
}, status=status.HTTP_201_CREATED)
|
}, status=status.HTTP_201_CREATED)
|
||||||
|
|
||||||
|
|
||||||
class UserInfo(generics.ListAPIView):
|
class UserInfo(generics.RetrieveAPIView):
|
||||||
permission_classes = [IsAuthenticated]
|
permission_classes = [IsAuthenticated]
|
||||||
serializer_class = UserSerializer
|
serializer_class = UserSerializer
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_object(self):
|
||||||
return User.objects.filter(username=self.request.user)
|
return self.request.user
|
||||||
|
|
||||||
|
|
||||||
class ProductView(viewsets.ModelViewSet):
|
class ProductView(viewsets.ModelViewSet):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user