Skip to content

Commit

Permalink
fix: Return no content on password reset (#21003)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjackwhite authored Mar 19, 2024
1 parent dbee1bb commit 921d208
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions posthog/api/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ def create(self, request: Request, *args: Any, **kwargs: Any) -> Response:
"""
response = super().create(request, *args, **kwargs)
response.status_code = getattr(self, "SUCCESS_STATUS_CODE", status.HTTP_200_OK)

if response.status_code == status.HTTP_204_NO_CONTENT:
response.data = None

return response


Expand Down
1 change: 1 addition & 0 deletions posthog/api/test/test_authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ def test_anonymous_user_can_request_password_reset(self, mock_capture):
response = self.client.post("/api/reset/", {"email": self.CONFIG_EMAIL})
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
self.assertEqual(response.content.decode(), "")
self.assertEqual(response.headers["Content-Length"], "0")

user: User = User.objects.get(email=self.CONFIG_EMAIL)
self.assertEqual(
Expand Down

0 comments on commit 921d208

Please sign in to comment.