Files
madbase/.trae/documents/plan_20260311_203811.md

1.3 KiB

I will implement the missing Authentication features (Phase 1 of the Roadmap): Password Reset and Email Confirmation.

1. Update auth Crate

I will modify auth/src/handlers.rs and auth/src/lib.rs to add the following endpoints:

  • POST /recover: Initiates the password reset flow.
    • Generates a recovery token.
    • (Mock) Sends a recovery email.
  • POST /verify: Verifies email confirmation or recovery tokens.
    • Supports type parameter (signup, recovery, magiclink, invite).
    • Updates email_confirmed_at or returns a session for recovery.
  • PUT /user: Allows authenticated users to update their password and metadata.

2. Update auth Models

I will update auth/src/models.rs to include:

  • RecoverRequest struct.
  • VerifyRequest struct.
  • UserUpdateRequest struct.

3. Update auth Utilities

I will update auth/src/utils.rs to include helper functions for:

  • Generating random tokens (for recovery/confirmation).

4. Integration Tests

I will add new tests to tests/integration/auth.test.ts to verify:

  • Password recovery flow (request -> verify -> update password).
  • Email confirmation flow (signup -> verify).

This completes Phase 1 of the roadmap. Future phases (Realtime, Storage, Edge Functions) will be addressed in subsequent steps.