login page 100%

This commit is contained in:
AdrienLSH
2024-01-16 09:36:07 +01:00
parent ff85c1d30c
commit 0edb865ad8
3 changed files with 42 additions and 22 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({'error': ['Username or password wrong.']}, status.HTTP_400_BAD_REQUEST)
return Response({'login': ['Invalid username or password.']}, status.HTTP_400_BAD_REQUEST)
login(request, user)
return Response({'id': user.pk}, status=status.HTTP_200_OK)