diff --git a/backend/videoflix/auth/views.py b/backend/videoflix/auth/views.py index 78a448d..cc533d2 100644 --- a/backend/videoflix/auth/views.py +++ b/backend/videoflix/auth/views.py @@ -40,7 +40,7 @@ class RegisterView(APIView): email = request.data.get('email') password = request.data.get('password') if CustomUser.objects.filter(email=email).exists(): - return Response({'detail': 'A user with this email already exists.'}, status=status.HTTP_400_BAD_REQUEST) + return Response({'mail': 'A user with this email already exists.'}, status=status.HTTP_400_BAD_REQUEST) serialized = UserSerializer(data=request.data) if serialized.is_valid(): @@ -81,7 +81,7 @@ class VerifyEmailView(APIView): user = CustomUser.objects.filter(Q(email=email) & Q(verify_email_token=token)).first() if user: if user.is_active: - return Response({"error": "User has already been activated"}, status=status.HTTP_409_CONFLICT) + return Response({"error": "User has already been activated."}, status=status.HTTP_409_CONFLICT) user.is_active = True user.save() @@ -93,7 +93,7 @@ class ForgotPasswordView(APIView): def post(self, request): email = request.data.get('email') if not email: - return Response({"error": "Email required."}, status=status.HTTP_400_BAD_REQUEST) + return Response({"mail": "Email required."}, status=status.HTTP_400_BAD_REQUEST) try: user = CustomUser.objects.get(email=email) @@ -101,7 +101,7 @@ class ForgotPasswordView(APIView): user.save() self.send_email(user) except CustomUser.DoesNotExist: - pass + return Response({"mail": "This email does not exist."}, status=status.HTTP_400_BAD_REQUEST) return Response(status=status.HTTP_200_OK) def send_email(self, user): diff --git a/frontend/src/app/components/auth/forgot-password/forgot-password.component.html b/frontend/src/app/components/auth/forgot-password/forgot-password.component.html index 0d2d0e1..6bbe597 100644 --- a/frontend/src/app/components/auth/forgot-password/forgot-password.component.html +++ b/frontend/src/app/components/auth/forgot-password/forgot-password.component.html @@ -25,6 +25,7 @@ !isUserEmailValid(authData.mail.toLowerCase()) && authData.mail.length > 0) " + (click)="this.errorService.clearError()" required />
This is not a valid email format
}} +{{ errors["mail"] }}
+This is not a valid email format
- }} @if ((errorService.error$ | async)) { -{{ errorService.error$ | async }}
- } + }} +{{ errors["mail"] }}
+