Open
Conversation
|
@CipherYuvraj is attempting to deploy a commit to the Annanya's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
🙌 Thanks @CipherYuvraj for raising this PR! |
Collaborator
Collaborator
|
@CipherYuvraj is it fixed? |
Author
|
done |
Collaborator
|
@CipherYuvraj deleting/deactivate features not working. |
Collaborator
|
@CipherYuvraj updates? |
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.

✅ My issue is assigned to me, and I have not taken up another task simultaneously.
🔁 I have pulled the latest changes from the main branch.
🧪 My code is tested and does not break existing functionality.
📚 I have added/updated documentation wherever necessary.
🧹 My code follows the project's coding standards.
✍️ My commits are clear and meaningful.
🧾 I have linked the issue this PR addresses with Closes #<issue_number>.
📌 Related Issue
Closes #99
🧠 Description
This PR implements comprehensive account deletion and deactivation functionality for DevSync, allowing users to manage their account lifecycle with proper safeguards and confirmations.
🔧 Backend Changes
Database Schema: Added isActive, deletedAt, and deactivatedAt fields to User model
API Endpoints:
DELETE /api/users/{id} - Permanently delete user account (GDPR compliant)
PATCH /api/users/{id}/deactivate - Temporarily deactivate account
PATCH /api/users/{id}/reactivate - Reactivate deactivated account
Security: Enhanced auth middleware to prevent deactivated users from accessing the platform
User Methods: Added softDelete(), deactivate(), and reactivate() methods to User model
🎨 Frontend Changes
Settings Page: Added "Danger Zone" section with account management options
AccountDangerZone Component: Clean UI with clear warnings and action buttons
ConfirmationModal Component: Reusable modal with different severity levels and type-to-confirm safety
Custom Hook: useAccountManagement for centralized account operations
User Experience:
Clear messaging for both deactivate ("disabled until reactivated") and delete ("permanently removed")
Confirmation modals with type-to-confirm for destructive actions
Loading states and proper error handling
Toast notifications for user feedback
🔒 Security Features
Users can only modify their own accounts
Deactivated accounts cannot log in until reactivated
Proper token validation and user verification
GDPR-compliant permanent data deletion
🎯 User Flow
Deactivate: User clicks → Warning modal → Type confirmation → Account disabled (can be reactivated)
Delete: User clicks → Danger modal → Type "DELETE" → Account permanently removed
Both actions automatically log out the user and redirect appropriately
✅ Type of Change
💡 Feature
🐞 Bug fix
🧹 Code cleanup/refactor
🧪 Test cases
📚 Docs update
📝 Additional Notes (Optional)
🛡️ Security Considerations
All endpoints require authentication and self-ownership verification
Deactivated users are immediately logged out and blocked from future access
Hard delete removes all user data permanently (GDPR Article 17 compliance)
🔄 Future Enhancements
Consider implementing cascade deletion for related data (projects, tasks, etc.)
Add admin reactivation capabilities if needed
Implement data export before deletion (GDPR Article 20)