feat: twofactor bind

This commit is contained in:
henry.chen
2025-07-17 15:24:46 +08:00
parent 91e1731909
commit e5100fa018
11 changed files with 125 additions and 19 deletions

View File

@@ -93,6 +93,8 @@ type General struct {
Length int
// 时区, 一般配置为 Asia/Shanghai
Timezone string
// 是否启用两步验证
TwoFactor bool
}
// Account 账户配置
@@ -101,12 +103,6 @@ type Account struct {
Username string
// *必须配置, 后台登录密码。登录后请后台立即修改
Password string
// 邮箱, 用于显示
Email string
// 手机号, 用于显示
PhoneNumber string
// 地址, 用于显示
Address string
}
// Blogger 博客配置, 无需配置,程序默认初始化,可在后台更改

View File

@@ -7,11 +7,12 @@ import "time"
// Account 博客账户
type Account struct {
Username string `gorm:"column:username;primaryKey" bson:"username"` // 用户名
Password string `gorm:"column:password;not null" bson:"password"` // 密码
Email string `gorm:"column:email;not null" bson:"email"` // 邮件地址
PhoneN string `gorm:"column:phone_n;not null" bson:"phone_n"` // 手机号
Address string `gorm:"column:address;not null" bson:"address"` // 地址信息
Username string `gorm:"column:username;primaryKey" bson:"username"` // 用户名
Password string `gorm:"column:password;not null" bson:"password"` // 密码
Email string `gorm:"column:email;not null" bson:"email"` // 邮件地址
PhoneN string `gorm:"column:phone_n;not null" bson:"phone_n"` // 手机号
Address string `gorm:"column:address;not null" bson:"address"` // 地址信息
TwoFactorSecret string `gorm:"column:two_factor_secret" bson:"two_factor_secret"` // 两步验证密钥
LogoutAt time.Time `gorm:"column:logout_at;not null" bson:"logout_at"` // 登出时间
LoginIP string `gorm:"column:login_ip;not null" bson:"login_ip"` // 最近登录IP