feat: Implement email change functionality

This commit introduces the following changes:

-   Added new API endpoints for email change requests and
    verification.
-   Updated the backend code to support email change workflow,
    including validation, code generation, and email sending.
-   Updated the frontend to include components for initiating and
    verifying email changes.
-   Added new dependencies to support email change functionality.
-   Updated the existing components to include email change
    functionality.

https://codeberg.org/mapleopentech/monorepo/issues/1
This commit is contained in:
Bartlomiej Mika 2025-12-05 15:29:26 -05:00
parent 480a2b557d
commit 598a7d3fad
19 changed files with 1213 additions and 65 deletions

View file

@ -121,6 +121,11 @@ type UserSecurityData struct {
// OTPBackupCodeHashAlgorithm tracks the hashing algorithm used.
OTPBackupCodeHashAlgorithm string `bson:"otp_backup_code_hash_algorithm" json:"-"`
// Email change verification fields
PendingEmail string `bson:"pending_email,omitempty" json:"pending_email,omitempty"` // New email pending verification
PendingEmailCode string `bson:"pending_email_code,omitempty" json:"pending_email_code,omitempty"` // Verification code for new email (sensitive, stored internally but never exposed in API responses)
PendingEmailExpiry time.Time `bson:"pending_email_expiry,omitempty" json:"pending_email_expiry,omitempty"` // When verification expires
}
type UserMetadata struct {