Skip to content

added a deactivating feature#154

Open
CipherYuvraj wants to merge 4 commits intoDevSyncx:mainfrom
CipherYuvraj:feature/deactivate
Open

added a deactivating feature#154
CipherYuvraj wants to merge 4 commits intoDevSyncx:mainfrom
CipherYuvraj:feature/deactivate

Conversation

@CipherYuvraj
Copy link

✅ 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)

@vercel
Copy link

vercel bot commented Oct 1, 2025

@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.

@github-actions
Copy link

github-actions bot commented Oct 1, 2025

🙌 Thanks @CipherYuvraj for raising this PR!
Our team will review it soon ⏳ — meanwhile, please make sure your PR follows our contributing guidelines 👉 Contributing Guidelines 🎉

@Annanyatiwary4
Copy link
Collaborator

image

fix this and also in navbar settings section is there , integrate your settings page to it ,so it the flow could be maintained.

@Annanyatiwary4
Copy link
Collaborator

@CipherYuvraj is it fixed?

@CipherYuvraj
Copy link
Author

done

@Annanyatiwary4
Copy link
Collaborator

@CipherYuvraj deleting/deactivate features not working.

@Annanyatiwary4
Copy link
Collaborator

@CipherYuvraj updates?

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.

User Account Deletion & Deactivation

2 participants