From c72517687878267a021641a689fdf73fe6d1c127 Mon Sep 17 00:00:00 2001 From: Anant Prakash Date: Tue, 9 Jul 2019 18:51:33 +0530 Subject: [PATCH] Fix http responses in validateRecaptcha (#431) fixes #421 --- clientapi/routing/register.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/clientapi/routing/register.go b/clientapi/routing/register.go index b1522e82..243f9dd2 100644 --- a/clientapi/routing/register.go +++ b/clientapi/routing/register.go @@ -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)