Fix http responses in validateRecaptcha (#431)

fixes #421
main
Anant Prakash 2019-07-09 18:51:33 +05:30 committed by Andrew Morgan
parent 69f8d5a77e
commit c725176878
1 changed files with 4 additions and 4 deletions

View File

@ -243,8 +243,8 @@ func validateRecaptcha(
) *util.JSONResponse {
if !cfg.Matrix.RecaptchaEnabled {
return &util.JSONResponse{
Code: http.StatusBadRequest,
JSON: jsonerror.BadJSON("Captcha registration is disabled"),
Code: http.StatusConflict,
JSON: jsonerror.Unknown("Captcha registration is disabled"),
}
}
@ -279,8 +279,8 @@ func validateRecaptcha(
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return &util.JSONResponse{
Code: http.StatusInternalServerError,
JSON: jsonerror.BadJSON("Error in contacting captcha server" + err.Error()),
Code: http.StatusGatewayTimeout,
JSON: jsonerror.Unknown("Error in contacting captcha server" + err.Error()),
}
}
err = json.Unmarshal(body, &r)