添加了更严格的邮箱格式检查
Some checks failed
Build / build (pull_request) Successful in 4m53s
Build / build-docker (pull_request) Failing after 2m0s

This commit is contained in:
WuYuuuub
2026-01-14 15:39:38 +08:00
parent 133c46c086
commit 9219e8c6ea
2 changed files with 22 additions and 0 deletions

View File

@@ -117,6 +117,16 @@ func (h *AuthHandler) SendVerificationCode(c *gin.Context) {
return
}
// 验证邮箱格式
if !isValidEmail(req.Email) {
h.logger.Warn("发送验证码失败:邮箱格式错误",
zap.String("email", req.Email),
)
RespondBadRequest(c, "邮箱格式错误", nil)
return
}
// 调用服务发送验证码
if err := h.container.VerificationService.SendCode(c.Request.Context(), req.Email, req.Type); err != nil {
h.logger.Error("发送验证码失败",
zap.String("email", req.Email),