Skip to content

Conversation

@guptapratykshh
Copy link
Contributor

@guptapratykshh guptapratykshh commented Jan 6, 2026

Description
This PR fixes a critical bug where users attempting to delete their accounts would encounter a 500 Internal Server Error. The root cause was that the user_delete() route handler was calling current_user.delete() without passing the required session parameter.

  • Fixed user_delete() function in augur/api/view/routes.py to pass db_session parameter to User.delete() method
  • Added try-except error handling to prevent unhandled exceptions
  • Added error logging for better debugging and issue tracking
  • Stored username before deletion to ensure success message displays correctly

This PR fixes #2672

Notes for Reviewers

Signed commits

  • Yes, I signed my commits.

@guptapratykshh guptapratykshh force-pushed the fix/delete-account-2672 branch 3 times, most recently from 2c82017 to a08dd38 Compare January 6, 2026 13:18
@guptapratykshh guptapratykshh force-pushed the fix/delete-account-2672 branch from ba588f4 to 1e7fa95 Compare January 7, 2026 16:36
@guptapratykshh guptapratykshh force-pushed the fix/delete-account-2672 branch 2 times, most recently from 8df7eb0 to 0cf49f2 Compare January 8, 2026 06:49
@guptapratykshh
Copy link
Contributor Author

Reverted all the imports and else block that were removed , please review the PR @MoralCode

@MoralCode
Copy link
Contributor

Code looks good! Just make sure to rebase your changes.

Id also be curious how this was tested/get a couple maintainers to give it the thumbs up. Overall looks like this is very close to being able to ship!

@guptapratykshh guptapratykshh force-pushed the fix/delete-account-2672 branch from 0cf49f2 to 51d3688 Compare January 9, 2026 20:39
@guptapratykshh
Copy link
Contributor Author

I tested this by checking the code (the User.delete() method needs a session parameter that wasn't being passed) and writing a mock test to verify the fix works correctly.

Also the docker build failure is not related to this PR. It is CI issue with the geckodriver download because gitHub API returned null. Rerunning the build should fix it.

- Pass required db_session parameter to current_user.delete()
- Add try-except block for proper exception handling
- Store username before deletion for accurate flash message
- Add error logging for debugging failed deletions

Signed-off-by: Pratyksh Gupta <pratykshgupta9999@gmail.com>
Signed-off-by: guptapratykshh <pratykshgupta9999@gmail.com>
@guptapratykshh guptapratykshh force-pushed the fix/delete-account-2672 branch from 0a52048 to 4793eaf Compare January 12, 2026 04:33
@MoralCode MoralCode added this to the v0.93.0 milestone Jan 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Delete account fails

2 participants