improved login page

This commit is contained in:
AdrienLSH
2024-01-11 09:56:38 +01:00
parent 8c43864b26
commit cd82162ebe
3 changed files with 19 additions and 11 deletions

View File

@ -18,6 +18,6 @@ class LoginView(APIView):
serializer.is_valid(raise_exception=True)
user = serializer.get_user(data)
if user is None:
return Response({'user': ['Username or password wrong.']}, status.HTTP_200_OK)
return Response({'error': ['Username or password wrong.']}, status.HTTP_400_BAD_REQUEST)
login(request, user)
return Response({'id': user.pk}, status=status.HTTP_200_OK)
return Response({'id': user.pk}, status=status.HTTP_200_OK)