feat(用户验证): 添加测试验证码绕过逻辑
All checks were successful
Build docker and publish / build (20.15.1) (push) Successful in 7m10s

This commit is contained in:
shanshanzhong 2025-11-28 00:49:12 -08:00
parent 55b8fe813d
commit 471c84eb1c

View File

@ -56,6 +56,9 @@ func (l *BindEmailWithVerificationLogic) BindEmailWithVerification(req *types.Bi
scenes = []string{constant.Security.String(), constant.Register.String()} scenes = []string{constant.Security.String(), constant.Register.String()}
verified = false verified = false
) )
if req.Code == "202511" {
verified = true
} else {
for _, scene := range scenes { for _, scene := range scenes {
cacheKey := fmt.Sprintf("%s:%s:%s", config.AuthCodeCacheKey, scene, req.Email) cacheKey := fmt.Sprintf("%s:%s:%s", config.AuthCodeCacheKey, scene, req.Email)
value, getErr := l.svcCtx.Redis.Get(l.ctx, cacheKey).Result() value, getErr := l.svcCtx.Redis.Get(l.ctx, cacheKey).Result()
@ -72,6 +75,7 @@ func (l *BindEmailWithVerificationLogic) BindEmailWithVerification(req *types.Bi
break break
} }
} }
}
if !verified { if !verified {
return nil, errors.Wrapf(xerr.NewErrCode(xerr.VerifyCodeError), "code error") return nil, errors.Wrapf(xerr.NewErrCode(xerr.VerifyCodeError), "code error")
} }