mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-03 16:00:25 +08:00
feat: 新增双因素校验(OTP)
This commit is contained in:
@@ -27,6 +27,12 @@ func InitAccountRouter(router *gin.RouterGroup) {
|
||||
Handle(a.Login)
|
||||
})
|
||||
|
||||
account.POST("otp-verify", func(g *gin.Context) {
|
||||
req.NewCtxWithGin(g).
|
||||
DontNeedToken().
|
||||
Handle(a.OtpVerify)
|
||||
})
|
||||
|
||||
// 获取个人账号的权限资源信息
|
||||
account.GET("/permissions", func(c *gin.Context) {
|
||||
req.NewCtxWithGin(c).Handle(a.GetPermissions)
|
||||
@@ -77,6 +83,14 @@ func InitAccountRouter(router *gin.RouterGroup) {
|
||||
Handle(a.ChangeStatus)
|
||||
})
|
||||
|
||||
resetOtpSecret := req.NewLogInfo("重置OTP密钥").WithSave(true)
|
||||
account.PUT(":id/reset-otp", func(c *gin.Context) {
|
||||
req.NewCtxWithGin(c).
|
||||
WithRequiredPermission(addAccountPermission).
|
||||
WithLog(resetOtpSecret).
|
||||
Handle(a.ResetOtpSecret)
|
||||
})
|
||||
|
||||
delAccount := req.NewLogInfo("删除账号").WithSave(true)
|
||||
delAccountPermission := req.NewPermission("account:del")
|
||||
account.DELETE(":id", func(c *gin.Context) {
|
||||
|
||||
Reference in New Issue
Block a user