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/
|
||||
"""
|
||||
from pathlib import Path
|
||||
|
||||
from datetime import timedelta
|
||||
from decouple import config
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
@ -144,4 +144,11 @@ SPECTACULAR_SETTINGS = {
|
||||
}
|
||||
CORS_ALLOWED_ORIGINS = [
|
||||
"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)
|
||||
|
||||
|
||||
class UserInfo(generics.ListAPIView):
|
||||
class UserInfo(generics.RetrieveAPIView):
|
||||
permission_classes = [IsAuthenticated]
|
||||
serializer_class = UserSerializer
|
||||
|
||||
def get_queryset(self):
|
||||
return User.objects.filter(username=self.request.user)
|
||||
def get_object(self):
|
||||
return self.request.user
|
||||
|
||||
|
||||
class ProductView(viewsets.ModelViewSet):
|
||||
|
Loading…
x
Reference in New Issue
Block a user