Skip to content

Implement account deletion with confirmation dialog#1

Open
SpeedGenius00 wants to merge 2 commits intomainfrom
claude/delete-github-account-Jnz5e
Open

Implement account deletion with confirmation dialog#1
SpeedGenius00 wants to merge 2 commits intomainfrom
claude/delete-github-account-Jnz5e

Conversation

@SpeedGenius00
Copy link
Copy Markdown
Owner

Summary

This PR implements a complete account deletion feature with a safety confirmation dialog. Users can now permanently delete their accounts from the settings page, with proper cleanup of Stripe subscriptions and cascading deletion of related data.

Key Changes

  • Frontend UI: Replaced disabled "Delete Account" button with an interactive confirmation dialog that requires users to type "DELETE" to confirm
  • Dialog Component: Added a modal dialog with clear warnings about permanent data loss, including detections, certificates, API keys, and billing information
  • API Endpoint: Created new DELETE /api/user/account route that:
    • Validates user authentication
    • Cancels active Stripe subscriptions before deletion
    • Deletes the user account with cascading deletes for related records
    • Handles errors gracefully with proper logging
  • Session Management: Automatically signs out the user and redirects to home page after successful deletion
  • UX Improvements: Added loading state during deletion, disabled inputs while processing, and provides clear success/error feedback via toast notifications

Implementation Details

  • The confirmation dialog resets the input field when opened/closed to prevent accidental submissions
  • Stripe subscription cancellation is attempted but won't block account deletion if it fails
  • Database cascading deletes handle cleanup of accounts, sessions, certificates, API keys, webhooks, and notifications
  • Detections are preserved with onDelete: SetNull to maintain historical records without user association
  • Proper error handling with user-friendly error messages

https://claude.ai/code/session_01CgXqXQP7AZ6eXBpF69i7CW

Users can now delete their account from Settings > Danger Zone.
The flow requires typing "DELETE" to confirm, cancels any active
Stripe subscription, deletes the user record (cascading to related
data), and signs the user out.

https://claude.ai/code/session_01CgXqXQP7AZ6eXBpF69i7CW
Adds GitHub alongside Google on both the login and signup pages.
Requires GITHUB_ID and GITHUB_SECRET environment variables to be set.

https://claude.ai/code/session_01CgXqXQP7AZ6eXBpF69i7CW
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.

2 participants