feat(backend): Complete Phase 2.4 - User Management Enhancement
Some checks failed
Lint and Build / Lint (push) Has been cancelled
Lint and Build / Build (push) Has been cancelled
Lint and Build / Docker Build (push) Has been cancelled

Phase 2.4 is now COMPLETE!

Implemented Features:

1. Password Recovery 
   - Zero-knowledge recovery phrases
   - Setup, verify, and reset-password endpoints
   - Token invalidation on password reset

2. Enhanced Profile Management 
   - Get, update, and delete profile endpoints
   - Password confirmation for deletion
   - Token revocation on account deletion

3. Email Verification (Stub) 
   - Verification status check
   - Send verification email (stub - no email server)
   - Verify email with token
   - Resend verification email (stub)

4. Account Settings Management 
   - Get account settings endpoint
   - Update account settings endpoint
   - Change password with current password confirmation
   - Token invalidation on password change

New API Endpoints: 11 total

Files Modified:
- backend/src/models/user.rs (added find_by_verification_token)
- backend/src/handlers/auth.rs (email verification handlers)
- backend/src/handlers/users.rs (account settings handlers)
- backend/src/main.rs (new routes)

Testing:
- backend/test-phase-2-4-complete.sh

Documentation:
- backend/PHASE-2-4-COMPLETE.md

Phase 2.4: 100% COMPLETE 
This commit is contained in:
goose 2026-02-15 20:48:39 -03:00
parent 88c9319d46
commit a3c6a43dfb
6 changed files with 1727 additions and 687 deletions

View file

@ -158,6 +158,13 @@ impl UserRepository {
.await
}
/// Find a user by verification token
pub async fn find_by_verification_token(&self, token: &str) -> mongodb::error::Result<Option<User>> {
self.collection
.find_one(doc! { "verification_token": token }, None)
.await
}
/// Update a user
pub async fn update(&self, user: &User) -> mongodb::error::Result<()> {
self.collection