feat(auth): 用户账户 - 完善个人资料与登录日志 (#752)

Co-authored-by: wuligao <1247662379@qq.com>
This commit is contained in:
ddcat666andwuligao authored and GitHub committed 2026-10-13 05:31:30 +08:00
1 parent e70fe1b9c9
commit 4c1d2b4012
83 files changed
+5836 -328

No files matched your search

+21 -15
View File
@@ -10,6 +10,9 @@ type User struct {
EmailVerifiedAt *time.Time `json:"emailVerifiedAt,omitempty"`
PhoneVerifiedAt *time.Time `json:"phoneVerifiedAt,omitempty"`
DisplayName string `json:"displayName" gorm:"size:80"`
AvatarMode string `json:"avatarMode" gorm:"size:16"`
AvatarPreset string `json:"avatarPreset,omitempty" gorm:"size:16"`
AvatarVersion string `json:"-" gorm:"size:36"`
Role UserRole `json:"role" gorm:"index;size:24"`
Status UserStatus `json:"status" gorm:"index;size:24"`
PasswordHash string `json:"-"`
@@ -19,12 +22,13 @@ type User struct {
}
type AuthSession struct {
ID string `json:"id" gorm:"primaryKey;size:36"`
UserID string `json:"userId" gorm:"index;size:36"`
TokenHash string `json:"-"`
ExpiresAt time.Time `json:"expiresAt" gorm:"index"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
ReauthenticatedAt *time.Time `json:"-"`
ID string `json:"id" gorm:"primaryKey;size:36"`
UserID string `json:"userId" gorm:"index;size:36"`
TokenHash string `json:"-"`
ExpiresAt time.Time `json:"expiresAt" gorm:"index"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
type UserIdentity struct {
@@ -39,15 +43,17 @@ type UserIdentity struct {
}
type OAuthState struct {
ID string `json:"id" gorm:"primaryKey;size:36"`
Provider string `json:"provider" gorm:"index;size:32"`
StateHash string `json:"-" gorm:"uniqueIndex;size:64"`
CodeVerifier string `json:"-" gorm:"size:160"`
NextPath string `json:"nextPath"`
AcceptedTerms bool `json:"acceptedTerms" gorm:"not null;default:false"`
ExpiresAt time.Time `json:"expiresAt" gorm:"index"`
UsedAt *time.Time `json:"usedAt" gorm:"index"`
CreatedAt time.Time `json:"createdAt"`
ReauthUserID string `json:"-" gorm:"size:36"`
ReauthSessionID string `json:"-" gorm:"size:36"`
ID string `json:"id" gorm:"primaryKey;size:36"`
Provider string `json:"provider" gorm:"index;size:32"`
StateHash string `json:"-" gorm:"uniqueIndex;size:64"`
CodeVerifier string `json:"-" gorm:"size:160"`
NextPath string `json:"nextPath"`
AcceptedTerms bool `json:"acceptedTerms" gorm:"not null;default:false"`
ExpiresAt time.Time `json:"expiresAt" gorm:"index"`
UsedAt *time.Time `json:"usedAt" gorm:"index"`
CreatedAt time.Time `json:"createdAt"`
}
type EmailVerificationCode struct {