feat: Implement account deletion (mark for removal) feature
All checks were successful
Gitea Actions Demo / build-and-push (push) Successful in 23s

- Added `marked_for_deletion` and `marked_for_deletion_at` fields to User model (Python and TypeScript) with serialization updates
- Created POST /api/user/mark-for-deletion endpoint with JWT auth, error handling, and SSE event trigger
- Blocked login and password reset for marked users; added new error codes ACCOUNT_MARKED_FOR_DELETION and ALREADY_MARKED
- Updated UserProfile.vue with "Delete My Account" button, confirmation modal (email input), loading state, success/error modals, and sign-out/redirect logic
- Synced error codes and model fields between backend and frontend
- Added and updated backend and frontend tests to cover all flows and edge cases
- All Acceptance Criteria from the spec are complete and verified
This commit is contained in:
2026-02-06 16:19:08 -05:00
parent 47541afbbf
commit 0d651129cb
20 changed files with 1054 additions and 18 deletions

View File

@@ -16,6 +16,8 @@ class User(BaseModel):
pin: str = ''
pin_setup_code: str = ''
pin_setup_code_created: str | None = None
marked_for_deletion: bool = False
marked_for_deletion_at: str | None = None
@classmethod
def from_dict(cls, d: dict):
@@ -33,6 +35,8 @@ class User(BaseModel):
pin=d.get('pin', ''),
pin_setup_code=d.get('pin_setup_code', ''),
pin_setup_code_created=d.get('pin_setup_code_created'),
marked_for_deletion=d.get('marked_for_deletion', False),
marked_for_deletion_at=d.get('marked_for_deletion_at'),
id=d.get('id'),
created_at=d.get('created_at'),
updated_at=d.get('updated_at')
@@ -54,6 +58,8 @@ class User(BaseModel):
'image_id': self.image_id,
'pin': self.pin,
'pin_setup_code': self.pin_setup_code,
'pin_setup_code_created': self.pin_setup_code_created
'pin_setup_code_created': self.pin_setup_code_created,
'marked_for_deletion': self.marked_for_deletion,
'marked_for_deletion_at': self.marked_for_deletion_at
})
return base