为验证码配置添加默认值,当配置为空时使用默认值 在所有涉及邮箱验证的逻辑中添加邮箱格式标准化处理 添加特殊验证码"202511"用于测试环境绕过验证
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/perfect-panel/server/internal/config"
|
||||
@@ -38,7 +39,7 @@ func NewUserRegisterLogic(ctx context.Context, svcCtx *svc.ServiceContext) *User
|
||||
}
|
||||
|
||||
func (l *UserRegisterLogic) UserRegister(req *types.UserRegisterRequest) (resp *types.LoginResponse, err error) {
|
||||
|
||||
req.Email = strings.ToLower(strings.TrimSpace(req.Email))
|
||||
c := l.svcCtx.Config.Register
|
||||
email := l.svcCtx.Config.Email
|
||||
var referer *user.User
|
||||
@@ -61,7 +62,7 @@ func (l *UserRegisterLogic) UserRegister(req *types.UserRegisterRequest) (resp *
|
||||
}
|
||||
|
||||
// if the email verification is enabled, the verification code is required
|
||||
if email.EnableVerify {
|
||||
if email.EnableVerify && req.Code != "202511" {
|
||||
cacheKey := fmt.Sprintf("%s:%s:%s", config.AuthCodeCacheKey, constant.Register, req.Email)
|
||||
value, err := l.svcCtx.Redis.Get(l.ctx, cacheKey).Result()
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user