添加了更严格的邮箱格式检查
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user