mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-03 16:00:25 +08:00
fix: 遗漏sql补充
This commit is contained in:
@@ -89,6 +89,7 @@ func (a *Account) Login(rc *req.Ctx) {
|
||||
accessToken := req.CreateToken(account.Id, username)
|
||||
// 若系统配置中设置开启otp双因素校验,则进行otp校验
|
||||
if accountLoginSecurity.UseOtp {
|
||||
account.OtpSecretDecrypt()
|
||||
otpSecret := account.OtpSecret
|
||||
// 修改状态为已注册
|
||||
otpStatus = OtpStatusReg
|
||||
@@ -164,6 +165,7 @@ func (a *Account) OtpVerify(rc *req.Ctx) {
|
||||
if otpStatus == OtpStatusNoReg {
|
||||
update := &entity.Account{OtpSecret: otpSecret}
|
||||
update.Id = accountId
|
||||
update.OtpSecretEncrypt()
|
||||
a.AccountApp.Update(update)
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ type AccountManageVO struct {
|
||||
Username string `json:"username"`
|
||||
Status int `json:"status"`
|
||||
LastLoginTime *time.Time `json:"lastLoginTime"`
|
||||
OtpSecret string `json:"otpSecret"`
|
||||
}
|
||||
|
||||
// 账号角色信息
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"mayfly-go/internal/common/utils"
|
||||
"mayfly-go/pkg/model"
|
||||
"time"
|
||||
)
|
||||
@@ -26,6 +27,17 @@ func (a *Account) IsEnable() bool {
|
||||
return a.Status == AccountEnableStatus
|
||||
}
|
||||
|
||||
func (a *Account) OtpSecretEncrypt() {
|
||||
a.OtpSecret = utils.PwdAesEncrypt(a.OtpSecret)
|
||||
}
|
||||
|
||||
func (a *Account) OtpSecretDecrypt() {
|
||||
if a.OtpSecret == "-" {
|
||||
return
|
||||
}
|
||||
a.OtpSecret = utils.PwdAesDecrypt(a.OtpSecret)
|
||||
}
|
||||
|
||||
const (
|
||||
AccountEnableStatus int8 = 1 // 启用状态
|
||||
AccountDisableStatus int8 = -1 // 禁用状态
|
||||
|
||||
@@ -12,8 +12,9 @@ func InitSysConfigRouter(router *gin.RouterGroup) {
|
||||
r := &api.Config{ConfigApp: application.GetConfigApp()}
|
||||
db := router.Group("sys/configs")
|
||||
{
|
||||
baseP := req.NewPermission("config:base")
|
||||
db.GET("", func(c *gin.Context) {
|
||||
req.NewCtxWithGin(c).Handle(r.Configs)
|
||||
req.NewCtxWithGin(c).WithRequiredPermission(baseP).Handle(r.Configs)
|
||||
})
|
||||
|
||||
db.GET("/value", func(c *gin.Context) {
|
||||
@@ -21,7 +22,7 @@ func InitSysConfigRouter(router *gin.RouterGroup) {
|
||||
})
|
||||
|
||||
saveConfig := req.NewLogInfo("保存系统配置信息").WithSave(true)
|
||||
saveConfigP := req.NewPermission("config:base")
|
||||
saveConfigP := req.NewPermission("config:save")
|
||||
db.POST("", func(c *gin.Context) {
|
||||
req.NewCtxWithGin(c).
|
||||
WithLog(saveConfig).
|
||||
|
||||
Reference in New Issue
Block a user