fix: use fixed code for registration verification

This commit is contained in:
richjohnrambo
2026-08-19 16:52:20 +08:00
parent 219ecadf4c
commit 405dad2eef
2 changed files with 20 additions and 15 deletions
+8 -5
View File
@@ -664,12 +664,15 @@ func serveIMVerificationCodes(wrt http.ResponseWriter, req *http.Request) {
writeIMError(wrt, req, http.StatusInternalServerError, 90000, imReasonInternal, "internal error", nil)
return
}
code, err := randomIMNumericCode(imVerificationCodeLength)
if err != nil {
writeIMError(wrt, req, http.StatusInternalServerError, 90000, imReasonInternal, "internal error", nil)
return
code := "123456"
if scene != "register" {
code, err = randomIMNumericCode(imVerificationCodeLength)
if err != nil {
writeIMError(wrt, req, http.StatusInternalServerError, 90000, imReasonInternal, "internal error", nil)
return
}
}
deliveryEnabled := scene != "register" || registrationSMSEnabled(now)
deliveryEnabled := scene != "register" && registrationSMSEnabled(now)
vc := &types.VerificationCode{
TenantID: tenant.ID,
ChallengeID: challengeID,