fix: captcha preview panic when clientId or clientSecret is empty (#824)

* fix: captcha preview panic when clientId or clientSecret is empty

* return original errors from captcha
This commit is contained in:
Resulte Lee
2022-06-26 22:09:57 +08:00
committed by GitHub
parent 339c6c2dd0
commit 477d386f3c
4 changed files with 20 additions and 6 deletions

View File

@ -63,10 +63,10 @@ func (c *ApiController) SendVerificationCode() {
}
isHuman, err := captchaProvider.VerifyCaptcha(checkKey, checkId)
if err != nil {
c.ResponseError("Failed to verify captcha: %v", err)
c.ResponseError(err.Error())
return
}
if !isHuman {
c.ResponseError("Turing test failed.")
return
@ -209,7 +209,7 @@ func (c *ApiController) VerifyCaptcha() {
isValid, err := provider.VerifyCaptcha(captchaToken, clientSecret)
if err != nil {
c.ResponseError("Failed to verify captcha: %v", err)
c.ResponseError(err.Error())
return
}