Exemplo n.º 1
0
        public static bool IsValidRequest(string recaptchaResponse)
        {
            var response = ConvertHelper.JsonToObject <GoogleRecaptchaVerifyResponse>(HttpHelper.HttpPost(GoogleRecaptchaVerifyUrl, new Dictionary <string, string>
            {
                { "response", recaptchaResponse },
                { "secret", GoogleRecaptchaSecret }
            }));

            if (response.Success)
            {
                return(true);
            }
            Logger.Error($"GoogleRecaptchaVerifyFail, response:{recaptchaResponse},error codes:{string.Join(",", response.ErrorCodes ?? new string[0])}");
            return(false);
        }