remove redundant code

This commit is contained in:
dxl 2022-10-27 10:31:40 +08:00
parent 3c7296ed12
commit 90a9db2fea

View file

@ -384,7 +384,7 @@ func validateRecaptcha(
if err != nil { if err != nil {
return &util.JSONResponse{ return &util.JSONResponse{
Code: http.StatusInternalServerError, Code: http.StatusInternalServerError,
JSON: jsonerror.BadJSON("Error in unmarshaling captcha server's response: " + err.Error()+"\n"+ string(body) + "\n"+clientip), JSON: jsonerror.BadJSON("Error in unmarshaling captcha server's response: " + err.Error()),
} }
} }
@ -750,8 +750,7 @@ func handleRegistrationFlow(
switch r.Auth.Type { switch r.Auth.Type {
case authtypes.LoginTypeRecaptcha: case authtypes.LoginTypeRecaptcha:
// Check given captcha response // Check given captcha response
clientIp, _, _ := net.SplitHostPort(req.RemoteAddr) resErr := validateRecaptcha(cfg, r.Auth.Response, req.RemoteAddr)
resErr := validateRecaptcha(cfg, r.Auth.Response, clientIp)
if resErr != nil { if resErr != nil {
return *resErr return *resErr
} }