feat: fix captcha none type bug (#1572)

This commit is contained in:
Yaodong Yu
2023-02-19 16:56:51 +08:00
committed by GitHub
parent 6131286cbd
commit e71e41b343

View File

@ -70,15 +70,17 @@ func (c *ApiController) SendVerificationCode() {
c.ResponseError(c.T("general:Missing parameter") + ": checkType.") c.ResponseError(c.T("general:Missing parameter") + ": checkType.")
return return
} }
if checkKey == "" {
c.ResponseError(c.T("general:Missing parameter") + ": checkKey.")
return
}
if !strings.Contains(applicationId, "/") { if !strings.Contains(applicationId, "/") {
c.ResponseError(c.T("verification:Wrong parameter") + ": applicationId.") c.ResponseError(c.T("verification:Wrong parameter") + ": applicationId.")
return return
} }
if checkType != "none" {
if checkKey == "" {
c.ResponseError(c.T("general:Missing parameter") + ": checkKey.")
return
}
if captchaProvider := captcha.GetCaptchaProvider(checkType); captchaProvider == nil { if captchaProvider := captcha.GetCaptchaProvider(checkType); captchaProvider == nil {
c.ResponseError(c.T("general:don't support captchaProvider: ") + checkType) c.ResponseError(c.T("general:don't support captchaProvider: ") + checkType)
return return
@ -89,6 +91,7 @@ func (c *ApiController) SendVerificationCode() {
c.ResponseError(c.T("verification:Turing test failed.")) c.ResponseError(c.T("verification:Turing test failed."))
return return
} }
}
application := object.GetApplication(applicationId) application := object.GetApplication(applicationId)
organization := object.GetOrganization(util.GetId(application.Owner, application.Organization)) organization := object.GetOrganization(util.GetId(application.Owner, application.Organization))