diff --git a/config/config.yaml b/config/config.yaml index bf9f3309c..3190bb34f 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -705,7 +705,7 @@ demo: enable: true superCode: 666666 #超级验证码,建议修改掉,收不到短信验证码时可以用此替代 # second - codeTTL: 300 + codeTTL: 60 mail: #仅支持qq邮箱,具体操作参考 https://service.mail.qq.com/cgi-bin/help?subtype=1&id=28&no=1001256 必须修改 title: "openIM" senderMail: "765567899@qq.com" diff --git a/internal/demo/register/send_code.go b/internal/demo/register/send_code.go index 1305ee801..6bb41f153 100644 --- a/internal/demo/register/send_code.go +++ b/internal/demo/register/send_code.go @@ -75,13 +75,19 @@ func SendVerificationCode(c *gin.Context) { accountKey = accountKey + "_" + constant.VerificationCodeForRegisterSuffix ok, err := db.DB.JudgeAccountEXISTS(accountKey) if ok || err != nil { - log.NewError(params.OperationID, "Repeat send code", params) + log.NewError(params.OperationID, "Repeat send code", params, accountKey) c.JSON(http.StatusOK, gin.H{"errCode": constant.RepeatSendCode, "errMsg": "Repeat send code"}) return } case constant.VerificationCodeForReset: accountKey = accountKey + "_" + constant.VerificationCodeForResetSuffix + ok, err := db.DB.JudgeAccountEXISTS(accountKey) + if ok || err != nil { + log.NewError(params.OperationID, "Repeat send code", params, accountKey) + c.JSON(http.StatusOK, gin.H{"errCode": constant.RepeatSendCode, "errMsg": "Repeat send code"}) + return + } } rand.Seed(time.Now().UnixNano()) code := 100000 + rand.Intn(900000)