feat: users.email_verified_at records a proved address (mail activation, reset code)

- additive migration 202610210001_add_users_email_verified_at (ADD COLUMN IF NOT EXISTS, no backfill, no-op rollback)
- User.EmailVerifiedAt (json:"-", not fillable)
- VerifyActivationCode and ResetPassword stamp it in the write that activates or stores the password
This commit is contained in:
Jakub Zych
2026-10-21 13:53:19 +02:00
parent c7635c56e3
commit add1f7a806
6 changed files with 59 additions and 3 deletions

View File

@@ -41,6 +41,13 @@ type User struct {
// minutes (classes.TouchLastSeen). It is shown in the admin list and is
// never part of a user API payload.
LastSeen *time.Time `gorm:"column:last_seen" json:"-"`
// EmailVerifiedAt records when the owner proved control of Email (D-27).
// Only two flows write it: the mailed activation code
// (classes.VerifyActivationCode) and a completed reset-code password
// reset (controllers.ResetPassword). An email change through /update or
// the admin form clears it. It is never mass-assigned and never part of a
// user API payload; social sign-in matching reads it.
EmailVerifiedAt *time.Time `gorm:"column:email_verified_at" json:"-"`
// Permissions are the user's own frontend permissions (1 allows, -1
// denies). classes.MergedPermissions combines them with the groups'. They
// are written by the admin permission editor only and are never part of