mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-28 23:43:22 +00:00
feat: Suite de la gestion des sessions
This commit is contained in:
@ -148,8 +148,7 @@ class ProfileSimpleView(APIView):
|
||||
def delete(self, request, id):
|
||||
return bdd.delete_object(Profile, id)
|
||||
|
||||
@method_decorator(csrf_protect, name='dispatch')
|
||||
@method_decorator(ensure_csrf_cookie, name='dispatch')
|
||||
@method_decorator(csrf_exempt, name='dispatch')
|
||||
class LoginView(APIView):
|
||||
@swagger_auto_schema(
|
||||
operation_description="Connexion utilisateur",
|
||||
@ -168,13 +167,14 @@ class LoginView(APIView):
|
||||
'errorFields': openapi.Schema(type=openapi.TYPE_OBJECT),
|
||||
'errorMessage': openapi.Schema(type=openapi.TYPE_STRING),
|
||||
'profil': openapi.Schema(type=openapi.TYPE_INTEGER),
|
||||
'droit': openapi.Schema(type=openapi.TYPE_INTEGER)
|
||||
'droit': openapi.Schema(type=openapi.TYPE_INTEGER),
|
||||
'id': openapi.Schema(type=openapi.TYPE_INTEGER),
|
||||
}
|
||||
))
|
||||
}
|
||||
)
|
||||
def post(self, request):
|
||||
data=JSONParser().parse(request)
|
||||
data = JSONParser().parse(request)
|
||||
validatorAuthentication = validator.ValidatorAuthentication(data=data)
|
||||
retour = error.returnMessage[error.WRONG_ID]
|
||||
validationOk, errorFields = validatorAuthentication.validate()
|
||||
@ -196,13 +196,12 @@ class LoginView(APIView):
|
||||
else:
|
||||
retour = error.returnMessage[error.WRONG_ID]
|
||||
|
||||
|
||||
return JsonResponse({
|
||||
'errorFields':errorFields,
|
||||
'errorMessage':retour,
|
||||
'profil':user.id if user else -1,
|
||||
'droit':user.droit if user else -1,
|
||||
#'jwtToken':jwt_token if profil != -1 else ''
|
||||
'errorFields': errorFields,
|
||||
'errorMessage': retour,
|
||||
'profil': user.id if user else -1,
|
||||
'droit': user.droit if user else -1,
|
||||
'id': user.id if user else -1,
|
||||
}, safe=False)
|
||||
|
||||
@method_decorator(csrf_protect, name='dispatch')
|
||||
|
||||
Reference in New Issue
Block a user