Implements a secure account deletion feature with multiple security safeguards. Users can delete their accounts through a modal interface that requires additional verification steps. The implementation uses a soft-deletion approach with a 30-day recovery window before permanent deletion. Security measures include password verification, email confirmation, and audit logging of all deletion events.
Key implementations:
- Enhanced
AccountDeletionModalwith multi-step verification - Added password re-verification before processing deletion
- Implemented email confirmation flow for deletion requests
- Created a deletion queue service with 30-day retention period
- Added audit logging for all deletion-related actions
- Updated JWT strategy to handle restoration of accounts within the recovery window
Objective: Verify that users must complete all security steps to delete their account.
Steps:
- Log in to the application
- Navigate to account settings
- Click the "Delete Account" button
- Verify the modal displays proper security warnings
- Enter account password for verification
- Confirm deletion intent by typing "DELETE" in the confirmation field
- Click "Request Account Deletion" button
- Verify a confirmation email is sent
- Click the verification link in the email
- Verify user is logged out and informed about the 30-day recovery window
Expected Outcome: Account should be marked as pending deletion, and the deletion should only be completed after proper verification and the waiting period.
Objective: Verify that users can cancel account deletion during the 30-day recovery window.
Steps:
- Complete the account deletion request process
- Within the 30-day window, log in with account credentials
- Verify user is presented with a "Restore Account" option
- Click "Restore Account"
Expected Outcome: The account deletion should be canceled, and the account should be fully restored to active status.
Objective: Verify that incorrect password prevents account deletion.
Steps:
- Initiate the account deletion process
- Enter an incorrect password in the verification field
- Click "Request Account Deletion"
Expected Outcome: The system should reject the request and display an error message about incorrect password.
Objective: Verify that rate limiting prevents abuse of the deletion feature.
Steps:
- Attempt to initiate account deletion multiple times in quick succession
Expected Outcome: After a certain number of attempts, the system should temporarily block further deletion requests and display an appropriate message.
Objective: Verify that all deletion-related actions are properly logged.
Steps:
- Complete the account deletion process
- As an admin, check the audit logs
Expected Outcome: The logs should contain detailed entries for each step of the deletion process, including initiation, email verification, and final deletion status.
Objective: Verify that accounts are permanently deleted after the recovery window.
Steps:
- Complete the account deletion process
- Simulate the passage of 30 days
- Verify the account data is permanently removed as per privacy policy
Expected Outcome: After 30 days, the account should be permanently deleted from the system (or anonymized per data protection requirements).