//2025-11-01 Google dropping support for captcha, just nuking it for now, see how much spam I get

This commit is contained in:
2025-11-01 17:41:44 +00:00
parent 8d188108a7
commit fbc3b1294a
4 changed files with 79 additions and 64 deletions

View File

@@ -65,8 +65,7 @@
<div class="form-group"> <div class="form-group">
<label asp-for="Contact.DbId" class="col-md-3 right">DbId:</label> <label asp-for="Contact.DbId" class="col-md-3 right">DbId:</label>
<div class="col-md-9"> <div class="col-md-9">
<input asp-for="Contact.DbId" placeholder="AyaNova Database Id (optional)" class="form-control" <input asp-for="Contact.DbId" placeholder="AyaNova Database Id (optional)" class="form-control" required />
required />
<span asp-validation-for="Contact.DbId"></span> <span asp-validation-for="Contact.DbId"></span>
</div> </div>
</div> </div>
@@ -99,7 +98,7 @@
<!-- Button --> <!-- Button -->
<div class="form-group"> <!-- <div class="form-group">
<label class="col-md-4 control-label" for="Send"></label> <label class="col-md-4 control-label" for="Send"></label>
<div class="col-md-4"> <div class="col-md-4">
@@ -107,12 +106,20 @@
</div> </div>
<button id="btnsubmit" type="submit" class="btn btn-info">Send us your question</button> <button id="btnsubmit" type="submit" class="btn btn-info">Send us your question</button>
</div> </div>
</div> -->
<div class="form-group">
<label class="col-md-4 control-label" for="Send"></label>
<div class="col-md-4">
<button type="submit" class="btn btn-info">Send us your question</button>
</div>
</div> </div>
<!-- <div class="row"> <!-- <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<button type="submit">Send</button> <button type="submit">Send us your question</button>
</div> </div>
</div> --> </div> -->
</form> </form>
<div class="row"> <div class="row">
<div class="col-sm-12 col-md-12"> <div class="col-sm-12 col-md-12">
@@ -170,7 +177,7 @@
<div class="container text-center"> <div class="container text-center">
<div class="row"> <div class="row">
<hr> <hr>
<small><span>Ground Zero Tech-Works Inc., 05 - 3610 Christie Parkway Courtenay, BC V9N 9T6 Canada</span> <small><span>Ground Zero Tech-Works Inc., British Columbia, Canada</span>
<br> <br>
<span>Since 1999 AyaNova® is a registered trademark of Ground Zero Tech-Works Inc. in the United States and <span>Since 1999 AyaNova® is a registered trademark of Ground Zero Tech-Works Inc. in the United States and
other countries.</span> other countries.</span>

View File

@@ -51,14 +51,15 @@ namespace contact.Pages
} }
if (!ReCaptchaPassed( //2025-11-01 Google dropping support for captcha, just nuking it for now, see how much spam I get
Request.Form["g-recaptcha-response"], // that's how you get it from the Request object // if (!ReCaptchaPassed(
_configuration.GetSection("GoogleReCaptcha:secret").Value // Request.Form["g-recaptcha-response"], // that's how you get it from the Request object
)) // _configuration.GetSection("GoogleReCaptcha:secret").Value
{ // ))
//Return a fail code that will hopefully take us off the spammers list // {
return StatusCode(500); // //Return a fail code that will hopefully take us off the spammers list
} // return StatusCode(500);
// }
@@ -166,26 +167,26 @@ namespace contact.Pages
} }
//2025-11-01 Google dropping support for captcha, just nuking it for now, see how much spam I get
// public static bool ReCaptchaPassed(string gRecaptchaResponse, string secret)
// {
// HttpClient httpClient = new HttpClient();
// var res = httpClient.GetAsync($"https://www.google.com/recaptcha/api/siteverify?secret={secret}&response={gRecaptchaResponse}").Result;
// if (res.StatusCode != HttpStatusCode.OK)
// {
// // logger.LogError("Error while sending request to ReCaptcha");
// return false;
// }
public static bool ReCaptchaPassed(string gRecaptchaResponse, string secret) // string JSONres = res.Content.ReadAsStringAsync().Result;
{ // dynamic JSONdata = JObject.Parse(JSONres);
HttpClient httpClient = new HttpClient(); // if (JSONdata.success != "true")
var res = httpClient.GetAsync($"https://www.google.com/recaptcha/api/siteverify?secret={secret}&response={gRecaptchaResponse}").Result; // {
if (res.StatusCode != HttpStatusCode.OK) // return false;
{ // }
// logger.LogError("Error while sending request to ReCaptcha");
return false;
}
string JSONres = res.Content.ReadAsStringAsync().Result; // return true;
dynamic JSONdata = JObject.Parse(JSONres); // }
if (JSONdata.success != "true")
{
return false;
}
return true;
}
} }

View File

@@ -68,7 +68,7 @@
<!-- Button --> <!-- Button -->
<div class="form-group"> <!-- <div class="form-group">
<label class="col-md-4 control-label" for="Send"></label> <label class="col-md-4 control-label" for="Send"></label>
<div class="col-md-4"> <div class="col-md-4">
@@ -78,6 +78,13 @@
<button id="btnsubmit" type="submit" class="btn btn-info">Send us your request</button> <button id="btnsubmit" type="submit" class="btn btn-info">Send us your request</button>
</div> </div>
</div> -->
<div class="form-group">
<label class="col-md-4 control-label" for="Send"></label>
<div class="col-md-4">
<button type="submit" class="btn btn-info">Send us your request</button>
</div>
</div> </div>
</form> </form>
@@ -89,7 +96,7 @@
<div class="container text-center"> <div class="container text-center">
<div class="row"> <div class="row">
<hr> <hr>
<small><span> &copy; 2022 Ground Zero Tech-Works, Inc</span> <small><span>Ground Zero Tech-Works, Inc</span>
<br> <br>
<span><a href="https://ayanova.com/r/privacy.htm">Privacy Policy</a></span></small> <span><a href="https://ayanova.com/r/privacy.htm">Privacy Policy</a></span></small>

View File

@@ -67,15 +67,15 @@ namespace contact.Pages
return Page(); return Page();
} }
//2025-11-01 Google dropping support for captcha, just nuking it for now, see how much spam I get
if (!ReCaptchaPassed( // if (!ReCaptchaPassed(
Request.Form["g-recaptcha-response"], // that's how you get it from the Request object // Request.Form["g-recaptcha-response"], // that's how you get it from the Request object
_configuration.GetSection("GoogleReCaptcha:secret").Value // _configuration.GetSection("GoogleReCaptcha:secret").Value
)) // ))
{ // {
//Return a fail code that will hopefully take us off the spammers list // //Return a fail code that will hopefully take us off the spammers list
return StatusCode(500); // return StatusCode(500);
} // }
@@ -124,7 +124,7 @@ namespace contact.Pages
System.Text.Encoding.UTF8, System.Text.Encoding.UTF8,
"application/json"); "application/json");
var response = client.PostAsync("https://sockeye.ayanova.com/subscription-server-trial-request", body).Result; var response = client.PostAsync("https://sockeye.ayanova.com/subscription-server-trial-request", body).Result;
//var response = client.PostAsync("http://localhost:7676/subscription-server-trial-request", body).Result; //var response = client.PostAsync("http://localhost:7676/subscription-server-trial-request", body).Result;
// if (response.IsSuccessStatusCode) // if (response.IsSuccessStatusCode)
// { // {
@@ -202,26 +202,26 @@ namespace contact.Pages
} }
//2025-11-01 Google dropping support for captcha, just nuking it for now, see how much spam I get
// public static bool ReCaptchaPassed(string gRecaptchaResponse, string secret)
// {
// HttpClient httpClient = new HttpClient();
// var res = httpClient.GetAsync($"https://www.google.com/recaptcha/api/siteverify?secret={secret}&response={gRecaptchaResponse}").Result;
// if (res.StatusCode != HttpStatusCode.OK)
// {
// // logger.LogError("Error while sending request to ReCaptcha");
// return false;
// }
public static bool ReCaptchaPassed(string gRecaptchaResponse, string secret) // string JSONres = res.Content.ReadAsStringAsync().Result;
{ // dynamic JSONdata = JObject.Parse(JSONres);
HttpClient httpClient = new HttpClient(); // if (JSONdata.success != "true")
var res = httpClient.GetAsync($"https://www.google.com/recaptcha/api/siteverify?secret={secret}&response={gRecaptchaResponse}").Result; // {
if (res.StatusCode != HttpStatusCode.OK) // return false;
{ // }
// logger.LogError("Error while sending request to ReCaptcha");
return false;
}
string JSONres = res.Content.ReadAsStringAsync().Result; // return true;
dynamic JSONdata = JObject.Parse(JSONres); // }
if (JSONdata.success != "true")
{
return false;
}
return true;
}
} }