feat: 更新验证码逻辑,优化邮件验证功能,增加验证码冷却时间,改进用户体验Closes #17

This commit is contained in:
2025-09-24 09:33:09 +08:00
parent 291f52395b
commit e44637fb2a
19 changed files with 138 additions and 58 deletions

View File

@ -114,7 +114,13 @@ func (s *UserService) UserRegister(req *dto.UserRegisterReq) (*dto.UserRegisterR
func (s *UserService) RequestVerifyEmail(req *dto.VerifyEmailReq) (*dto.VerifyEmailResp, error) {
verifyCode := utils.RequestEmailVerify(req.Email)
template, err := static.RenderTemplate("email/verification-code.tmpl", map[string]interface{}{})
template, err := static.RenderTemplate("email/verification-code.tmpl", map[string]interface{}{
"Title": "NEO-BLOG",
"Email": req.Email,
"VerifyCode": verifyCode,
"Expire": 10,
"Details": "你正在验证电子邮件所有权",
})
if err != nil {
return nil, errs.ErrInternalServer
}