Repository navigation
Implement password reset and account deletion features - #4
Merged
Merged
Conversation
About and FAQ used to be routes, so reading either from the chat threw away the conversation you were looking at. Their bodies moved into components that both a page and a dialog can render; the header and the three-dots menu now open them over whatever you were doing, and the routes stay for direct links. Forgot password. A recovery link goes to the existing callback, which forwards to /auth/reset once the code is exchanged. The request form answers the same way whether or not the address has an account -- signIn already flattens its error for that reason, and anything else turns the form into an oracle. /forgot-password joins AUTH_PAGES; /auth/reset is PROTECTED instead, because the recovery link leaves a session behind and listing it as an auth page would bounce exactly the person who needs it. Delete account, behind a type-your-username confirmation. There is no service-role key here, so it goes through a security definer function rather than the admin API. Order matters in that function: attachment paths live only on the caller's messages and those cascade, so the storage rows go first. It also deletes the caller's conversations outright -- the reaper added in 20260825133149 fires at zero members, so a two-person chat losing one side would otherwise strand the conversation, the peer's membership and the peer's messages with nobody able to reach them. rls_test.sql now asserts that, and that the peer's own account survives. Fixed on the way past: the auth callback interpolated its `next` parameter straight into the redirect, so ?next=//evil.com walked the user off the site. It goes through safeRedirectPath now, like every other caller. Reset links carry a `next`, which is what made it load-bearing.
Supabase installs a storage.protect_delete() trigger that rejects any direct delete from storage.objects -- "Use the Storage API instead". Even the owner of a security definer function hits it, and the 42501 aborted the entire deletion, so the first version of this function could not delete an account at all. Running the regression test against the real database is what surfaced it. Storage is the client's job now. The dialog already removed the avatar through the Storage API before calling the RPC, which is the path policies actually permit and which deletes the bytes rather than just the row. Message attachments stay orphaned in the bucket, as the comment there records: there is no delete policy on that bucket and no service role to bypass it with.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a complete password reset flow, adds account deletion functionality, and refactors content pages for modularity and improved user experience. The most important changes are grouped below:
1. Password Reset Flow
2. Account Deletion
3. Content Page Refactoring
4. Validation and Security Improvements