This commit is contained in:
Tomáš Dvořák
2025-10-16 13:32:05 +02:00
commit 12cba639b9
663 changed files with 168914 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
package models
import (
"time"
"gorm.io/gorm"
)
// PasswordReset stores password reset tokens, verification codes, and their status
type PasswordReset struct {
gorm.Model
UserID uint `gorm:"index;not null" json:"user_id"`
User User `gorm:"foreignKey:UserID" json:"-"`
Token string `gorm:"uniqueIndex;size:128;not null" json:"token"`
ExpiresAt time.Time `gorm:"index;not null" json:"expires_at"`
UsedAt *time.Time `json:"used_at"`
IP string `json:"ip"`
UserAgent string `json:"user_agent"`
VerificationCode string `gorm:"size:6" json:"-"`
VerificationCodeExpires *time.Time `json:"verification_code_expires_at"`
VerificationAttempts int `gorm:"default:0" json:"verification_attempts"`
}
func (PasswordReset) TableName() string { return "password_resets" }