private string GetResponseErrorMessage(ReCaptchaResponse response) { IList<string> errors = new List<string>(); if (!response.Success && response.ErrorCodes == null) { errors.Add("Google Recaptcha: Unspecified Error"); } else { foreach (string error in response.ErrorCodes) { switch (error) { case "missing-input-secret": errors.Add("Google Recaptcha: The secret parameter is missing"); break; case "invalid-input-secret": errors.Add("Google Recaptcha: The secret parameter is invalid or malformed"); break; case "missing-input-response": errors.Add("Google Recaptcha: Please tick the \"I'm not a robot\" checkbox"); break; case "invalid-input-response": errors.Add("Google Recaptcha: The response parameter is invalid or malformed"); break; default: errors.Add(error); break; } } } return string.Join(", ", errors); }
private string GetResponseErrorMessage(ReCaptchaResponse response) { IList <string> errors = new List <string>(); if (!response.Success && response.ErrorCodes == null) { errors.Add("Google Recaptcha: Unspecified Error"); } else { foreach (string error in response.ErrorCodes) { switch (error) { case "missing-input-secret": errors.Add("Google Recaptcha: The secret parameter is missing"); break; case "invalid-input-secret": errors.Add("Google Recaptcha: The secret parameter is invalid or malformed"); break; case "missing-input-response": errors.Add("Google Recaptcha: Please tick the \"I'm not a robot\" checkbox"); break; case "invalid-input-response": errors.Add("Google Recaptcha: The response parameter is invalid or malformed"); break; default: errors.Add(error); break; } } } return(string.Join(", ", errors)); }