From 3b586b7bee8a081c48e0192ae9bc7a0f711c7c2d Mon Sep 17 00:00:00 2001 From: Sean Morley Date: Fri, 16 Aug 2024 11:47:53 -0400 Subject: [PATCH] Fix password reset issue --- backend/server/users/views.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/server/users/views.py b/backend/server/users/views.py index 85a35e62..cc605832 100644 --- a/backend/server/users/views.py +++ b/backend/server/users/views.py @@ -23,6 +23,9 @@ def post(self, request): user = request.user new_email = serializer.validated_data['new_email'] user.email = new_email + # remove all other email addresses for the user + user.emailaddress_set.exclude(email=new_email).delete() + user.emailaddress_set.create(email=new_email, primary=True, verified=False) user.save() return Response({"detail": "Email successfully changed."}, status=status.HTTP_200_OK) return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) \ No newline at end of file