mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-12-26 17:36:35 +08:00
refactor: 使用泛型重构参数绑定等
This commit is contained in:
@@ -47,7 +47,7 @@ func (a *AccountLogin) ReqConfs() *req.Confs {
|
||||
|
||||
// @router /auth/accounts/login [post]
|
||||
func (a *AccountLogin) Login(rc *req.Ctx) {
|
||||
loginForm := req.BindJsonAndValid(rc, new(form.LoginForm))
|
||||
loginForm := req.BindJsonAndValid[*form.LoginForm](rc)
|
||||
ctx := rc.MetaCtx
|
||||
|
||||
accountLoginSecurity := config.GetAccountLoginSecurity()
|
||||
@@ -96,8 +96,7 @@ type OtpVerifyInfo struct {
|
||||
|
||||
// OTP双因素校验
|
||||
func (a *AccountLogin) OtpVerify(rc *req.Ctx) {
|
||||
otpVerify := new(form.OtpVerfiy)
|
||||
req.BindJsonAndValid(rc, otpVerify)
|
||||
otpVerify := req.BindJsonAndValid[*form.OtpVerfiy](rc)
|
||||
ctx := rc.MetaCtx
|
||||
|
||||
tokenKey := fmt.Sprintf("otp:token:%s", otpVerify.OtpToken)
|
||||
|
||||
Reference in New Issue
Block a user