Compare commits

...

10 Commits

Author SHA1 Message Date
56cbe33356 2025-11-01 17:44:19 +00:00
fbc3b1294a //2025-11-01 Google dropping support for captcha, just nuking it for now, see how much spam I get 2025-11-01 17:41:44 +00:00
8d188108a7 case 4447 2023-03-28 01:18:33 +00:00
9ba5d027c7 2022-11-15 16:31:14 +00:00
1a4d8c3428 2022-10-17 21:13:17 +00:00
1d6cc8cffb 2022-10-07 00:35:02 +00:00
61785f0570 2022-10-06 17:54:16 +00:00
c9828e959b 2022-09-07 19:59:52 +00:00
886921d94e Changes to work with fastmail 2022-09-03 17:15:51 +00:00
75e1619803 2022-05-06 19:15:02 +00:00
9 changed files with 604 additions and 245 deletions

4
.vscode/launch.json vendored
View File

@@ -10,7 +10,7 @@
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/bin/Debug/net5.0/contact.dll",
"program": "${workspaceFolder}/bin/Debug/net6.0/contact.dll",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
@@ -20,7 +20,7 @@
"args": "${auto-detect-url}",
"windows": {
"command": "cmd.exe",
"args": "/C start http://localhost:3002/contact"
"args": "/C start http://localhost:3002/request"
},
"osx": {
"command": "open"

3
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"liveServer.settings.port": 5501
}

View File

@@ -1,196 +1,188 @@
@page
@model ContactModel
@{
ViewData["Title"] = "Contact";
ViewData["Title"] = "Contact";
}
<div class="container">
<div class="jumbotron text-center" style="background-image: url(images/jumbotronbackgroundABC.png); background-size: 100% no-repeat center;">
<font color="white"><h2>Have questions? We have answers!</h2>
</font>
</div><!--close jumbotron-->
<hr>
<p>&nbsp;</p>
<div class="container">
<div class="jumbotron text-center"
style="background-image: url(images/jumbotronbackgroundABC.png); background-size: 100% no-repeat center;">
<font color="white">
<h2>Have questions? We have answers!</h2>
</font>
</div>
<!--close jumbotron-->
<hr>
<div>
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel panel-default">
<div class="panel-body">
<ul>
<li>Check out the <a href="https://ayanova.com/faqanswers.htm">Answers to Frequently Asked Questions</a> including technical, configurations, licensing, pricing, purchasing and more</li>
</ul>
<ul>
<li>Follow along with the step tutorial <a href="https://www.ayanova.com/AyaNova7webHelp/index.html?basic_overview_of_a_workorder.htm">How do I...?'s</a> with screenshots in the AyaNova online Help documentation</li>
</ul>
<ul>
<li>Check out <a href="https://www.ayanova.com/AyaNova7webHelp/index.html?accessing_data_displayed_in_ma.htm">details about each feature</a> of AyaNova and/or its optional add-on in the AyaNova online Help documentation</li>
</ul>
<ul>
<li>View answers to common questions on the <a href="http://forum.ayanova.com" target="_blank">AyaNova Support Forum</a></li>
</ul>
<ul>
<li>Contact us via direct email at <strong>support@ayanova.com</strong></li>
</ul>
<ul>
<li>Have a quick question? Send us your question via our online form below</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<form class="form form-horizontal" method="post">
<div asp-validation-summary="All"></div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label asp-for="Contact.Name" class="col-md-3 right">Name:</label>
<div class="col-md-9">
<input asp-for="Contact.Name" class="form-control" required autofocus />
<span asp-validation-for="Contact.Name"></span>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label asp-for="Contact.Company" class="col-md-3 right">Company:</label>
<div class="col-md-9">
<input asp-for="Contact.Company" placeholder="Your Company Name" class="form-control" required />
<span asp-validation-for="Contact.Company"></span>
</div>
</div>
</div>
</div>
<p>&nbsp;</p>
<div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label asp-for="Contact.DbId" class="col-md-3 right">DbId:</label>
<div class="col-md-9">
<input asp-for="Contact.DbId" placeholder="AyaNova 8 Database Id (optional)" class="form-control" required />
<span asp-validation-for="Contact.DbId"></span>
<div class="col-sm-12 col-md-12">
<div class="panel panel-default">
<div class="panel-body">
<ul>
<li>Contact us via direct email at <strong>support@ayanova.com</strong></li>
</ul>
<ul>
<li>Or send us your question via our online form below</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<form class="form form-horizontal" method="post">
<div asp-validation-summary="All"></div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label asp-for="Contact.Name" class="col-md-3 right">Name:</label>
<div class="col-md-9">
<input asp-for="Contact.Name" class="form-control" required autofocus />
<span asp-validation-for="Contact.Name"></span>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label asp-for="Contact.Company" class="col-md-3 right">Company:</label>
<div class="col-md-9">
<input asp-for="Contact.Company" placeholder="Your Company Name" class="form-control" required />
<span asp-validation-for="Contact.Company"></span>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label asp-for="Contact.DbId" class="col-md-3 right">DbId:</label>
<div class="col-md-9">
<input asp-for="Contact.DbId" placeholder="AyaNova Database Id (optional)" class="form-control" required />
<span asp-validation-for="Contact.DbId"></span>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label asp-for="Contact.Email" class="col-md-3 right">Email:</label>
<div class="col-md-9">
<input asp-for="Contact.Email" placeholder="email@you.com" class="form-control" required />
<span asp-validation-for="Contact.Email"></span>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label asp-for="Contact.Message" class="col-md-3 right">Message:</label>
<div class="col-md-9">
<textarea asp-for="Contact.Message" placeholder="Any questions for us?" rows="6"
class="form-control"></textarea>
<span asp-validation-for="Contact.Message"></span>
</div>
</div>
</div>
</div>
<!-- Button -->
<!-- <div class="form-group">
<label class="col-md-4 control-label" for="Send"></label>
<div class="col-md-4">
<div class="g-recaptcha" data-callback="imNotARobot" data-sitekey="6LcH7GUUAAAAAJIDf_JDZolSv__xN6oqr9Dx79zs">
</div>
<button id="btnsubmit" type="submit" class="btn btn-info">Send us your question</button>
</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 class="row">
<div class="col-md-12">
<button type="submit">Send us your question</button>
</div>
</div> -->
</form>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label asp-for="Contact.Email" class="col-md-3 right">Email:</label>
<div class="col-md-9">
<input asp-for="Contact.Email" placeholder="email@you.com" class="form-control" required />
<span asp-validation-for="Contact.Email"></span>
<div class="col-sm-12 col-md-12">
<div class="panel panel-default">
<div class="panel-body">
<p>All of our responses are from real live people, so there could be a delay receiving a reply due to time
zone differences, time of day, weekend, or if a holiday long weekend.</p>
<strong>
<p>Why do we ask for your name, company name and email address?</p>
</strong>
<p>We use the information you send us to respond to you, to provide sales support and technicial support to
you and your company, and to make AyaNova recommendations and suggestions to you and your company. Also
refer to our <a href="https://www.ayanova.com/privacypolicy.htm" target="_blank">Privacy Policy</a> for more
clarity.</p>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label asp-for="Contact.Message" class="col-md-3 right">Message:</label>
<div class="col-md-9">
<textarea asp-for="Contact.Message" placeholder="Any questions for us?" rows="6" class="form-control"></textarea>
<span asp-validation-for="Contact.Message"></span>
<div>
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel panel-default">
<div class="panel-body">
<h3>If you have sent a question, but have not received a reply</h3>
<p>&nbsp;</p>
<p>We answer every email we receive promptly within business hours. Verify you used the correct email
address and check your spam folder.</p>
</div>
</div>
</div>
</div>
</div>
<div>
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel panel-default">
<div class="panel-body">
<h3>Can I phone someone or have someone phone me?</h3>
<p>In order to be able to provide an affordable product for small business with fast technical support
globally, we do not provide phone support.</p>
<p>Please contact us via the online form above, or send us a direct email to support@ayanova.com and our
North American support staff will respond promptly between 9:00AM and 5:00PM Pacific Standard Time (-8GMT/
UTC) Monday to Friday.</p>
<!-- Button -->
<div class="form-group">
<label class="col-md-4 control-label" for="Send"></label>
<div class="col-md-4">
<div class="g-recaptcha" data-callback="imNotARobot" data-sitekey="6LcH7GUUAAAAAJIDf_JDZolSv__xN6oqr9Dx79zs"></div>
<button id="btnsubmit" type="submit" class="btn btn-info" >Send us your question</button>
</div>
</div>
<!-- <div class="row">
<div class="col-md-12">
<button type="submit">Send</button>
</div>
</div>
</div>
</div>
</div> -->
</form>
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel panel-default">
<div class="panel-body">
<p>The email address you provided will automatically and immediately receive a copy of what you sent to us as confirmation too. </p>
<p>All of our responses are from real live people, so there could be a delay receiving a reply due to time zone differences, time of day, weekend, or if a holiday long weekend.</p>
<strong><p>Why do we ask for your name, company name and email address?</p></strong>
<p>We use the information you send us to respond to you, to provide sales support and technicial support to you and your company, and to make AyaNova recommendations and suggestions to you and your company. Also refer to our <a href="https://www.ayanova.com/privacypolicy.htm" target="_blank">Privacy Policy</a> for more clarity.</p>
</div>
</div>
</div>
</div>
</div>
<div>
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel panel-default">
<div class="panel-body">
<h3>If you have sent a question, but have not received a confirmation email</h3>
<p>&nbsp;</p>
<p><strong>1. Check the spelling of your email address:</strong></p>
<p>Just in case!</p>
<p>&nbsp;</p>
<p><strong>2. Confirm that your email address mailbox is not full:</strong></p>
<p>Your mailbox may have an email quota. And if email forwarding, do check both the email address originally sent to as well as the email address account being forwarded to.</p>
<p>&nbsp;</p>
<p><strong>3. Check your Junk folder:</strong></p>
<p>If you find the email(s) from us in your Junk folder, do edit your spam settings so that all email from support@ayanova.com is allowed.</p>
<p>&nbsp;</p>
<p><strong>4. Issues with HotMail or AOL accounts:</strong></p>
<p>If you have sent an email using a HotMail or AOL account (@@hotmail.com or @@aol.com), although we may receive it and have sent a reply, you may never receive our emails and we will never be advised that it was rejected by HotMail</p>
<p>You can also check out these two URL links about why not to use a HotMail account if you actually want to receive email from other's that do not have a HotMail account:</p>
<p><a href="http://www.theregister.com/2007/05/01/hotmail_friendly_fire/" target="_blank">http://www.theregister.com/2007/05/01/hotmail_friendly_fire/</a> </p>
<p><a href="http://www.iis-aid.com/articles/iis_aid_news/are_hotmail_cutting_their_own_throat" target="_blank">http://www.iis-aid.com/articles/iis_aid_news/are_hotmail_cutting_their_own_throat</a> </p>
<p>&nbsp;</p>
<p><strong>5. Your SPAM settings:</strong></p>
<p>Your email program or your ISP (Internet Service Provider) is using a spam filter that is filtering out all email from us, or certain email depending on the content.</p>
<p>You may need to edit your email program and/or contact your ISP to allow all email from support@ayanova.com </p>
<p>Once you have done this, either forward your previous email, or send a new email stating that you did not receive a reply due possibly to a spam filter, and we will resend the information.</p>
<p>We are not made aware by your spam filter that the email has not been received by you. The only way is if you confirm the receipt, or contact us again.</p>
</div>
</div>
</div>
</div>
</div>
<div>
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="panel panel-default">
<div class="panel-body">
<h3>Can I phone someone or have someone phone me?</h3>
<p>In order to be able to provide an affordable product for small business with fast technical support globally, we do not provide phone support.</p>
<p>Please contact us via the online form above, or send us a direct email to support@ayanova.com and our North American support staff will respond promptly between 9:00AM and 5:00PM Pacific Standard Time (-8GMT/ UTC) Monday to Friday.</p>
</div>
</div>
</div>
</div>
</div>
<!--start bottom container-->
<div class="container text-center">
<div class="row">
<hr>
<small><span>Ground Zero Tech-Works Inc., 05 - 3610 Christie Parkway Courtenay, BC V9N 9T6 Canada</span>
<br>
<span>Since 1999 AyaNova® is a registered trademark of Ground Zero Tech-Works Inc. in the United States and other countries.</span>
<br>
<span><a href="https://ayanova.com/license.htm">End User License Agreement</a></li> | <a href="https://ayanova.com/privacypolicy.htm">Privacy Policy</a></span></small>
</div>
</div>
<!--end bottom container-->
<!--start bottom container-->
<div class="container text-center">
<div class="row">
<hr>
<small><span>Ground Zero Tech-Works Inc., British Columbia, Canada</span>
<br>
<span>Since 1999 AyaNova® is a registered trademark of Ground Zero Tech-Works Inc. in the United States and
other countries.</span>
<br>
<span><a href="https://ayanova.com/privacypolicy.htm">Privacy Policy</a></span></small>
</div>
</div>
<!--end bottom container-->

View File

@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc.RazorPages;
using System.ComponentModel.DataAnnotations;
using Microsoft.AspNetCore.Mvc;
@@ -9,7 +6,6 @@ using System.Net.Mail;
using System.Net;
//for captcha:
using System.Net.Http;
using System.Net.Http.Headers;
using Newtonsoft.Json.Linq;
using Microsoft.Extensions.Configuration;
@@ -55,21 +51,39 @@ namespace contact.Pages
}
if (!ReCaptchaPassed(
Request.Form["g-recaptcha-response"], // that's how you get it from the Request object
_configuration.GetSection("GoogleReCaptcha:secret").Value
))
//2025-11-01 Google dropping support for captcha, just nuking it for now, see how much spam I get
// if (!ReCaptchaPassed(
// 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);
// }
//fuck those spammers
//2022-05-06 changes to get rid of jumbo lead magnet spammer but still force him to pay someone to manually enter the stuff
//ideally it should read from a text file here but this is a quickie fix while Joyce is on important viha phone call
var blocks = new List<string>();
blocks.Add("google");
blocks.Add("jumboleadmagnet");//<--fuck this guy in particular, keeps spamming
blocks.Add("boostleadgeneration");
//ericjonesmyemail@gmail.com
var companyname = Contact.Company.ToLowerInvariant();
foreach (string s in blocks)
{
//Return a fail code that will hopefully take us off the spammers list
return StatusCode(500);
if (companyname.Contains(s))
{
goto skipspam;
}
}
SendMail();
//fuck those Russian spammers
if (Contact.Company.ToLowerInvariant() != "google")
SendMail();
skipspam:
//TODO: go to a successful submit page on the ayanova site
//return Redirect("/confirm.html");//sample quickie page I made up
return Redirect("https://ayanova.com/confirmed.htm");
@@ -87,14 +101,15 @@ namespace contact.Pages
message.From = new MailAddress(Contact.Email);
message.Subject = $"Question about AyaNova from {Contact.Company}";
message.Body = MessageBody;
using (var smtpClient = new SmtpClient("mail.ayanova.com"))
using (var smtpClient = new SmtpClient("smtp.fastmail.com"))
{
smtpClient.Host = "mail.ayanova.com";
smtpClient.Port = 2525;
smtpClient.Host = "smtp.fastmail.com";
smtpClient.Port = 587;
smtpClient.UseDefaultCredentials = false;
//testing
// smtpClient.EnableSsl=true;
smtpClient.EnableSsl = true;
// smtpClient.Port=465;
// smtpClient.DeliveryMethod= SmtpDeliveryMethod.Network;
@@ -107,7 +122,14 @@ namespace contact.Pages
//TEST CRASH
// smtpClient.Credentials = new System.Net.NetworkCredential("noreply@ayanova.com", "91768700489f8edd28aa71e3e0f4073eba54ce83c4c1a6a910700fa94094ddfd");
smtpClient.Credentials = new System.Net.NetworkCredential("webmaster@ayanova.com", "c63c17add818fca81cae71a241ea1b552675a86280b7e7e45d36cbf2e8f3bc0e");
//FASTMAIL CHANGES
//Fastmail server names and ports help page: https://www.fastmail.help/hc/en-us/articles/1500000278342
//APP Password created in fastmail for smtp use only labelled 'contact-form': cnea8agl6nlx5j7l
//try using from as support@onayanova.com
//try domain version if this still won't work
smtpClient.Credentials = new System.Net.NetworkCredential("support@onayanova.com", "cnea8agl6nlx5j7l");
//******************************************************************************************************************
//******************************************************************************************************************
@@ -115,25 +137,27 @@ namespace contact.Pages
}
}
//SEND COPY TO CLIENT
using (var message = new MailMessage())
{
message.To.Add(new MailAddress(Contact.Email));
message.From = new MailAddress("support@ayanova.com");
message.Subject = $"Confirmation that your question about AyaNova has been received from {Contact.Company}";
message.Body = MessageBody;
//Removed 2022-10-06 causing backscatter and also not helpful
// //SEND COPY TO CLIENT
// using (var message = new MailMessage())
// {
// message.To.Add(new MailAddress(Contact.Email));
// message.From = new MailAddress("support@ayanova.com");
// message.Subject = $"Confirmation that your question about AyaNova has been received from {Contact.Company}";
// message.Body = MessageBody;
using (var smtpClient = new SmtpClient("mail.ayanova.com"))
{
// using (var smtpClient = new SmtpClient("smtp.fastmail.com"))
// {
smtpClient.Host = "mail.ayanova.com";
smtpClient.Port = 2525;
smtpClient.UseDefaultCredentials = false;
//NOTE: Do not use the noreply email address to send mail, it crashes the server somehow
smtpClient.Credentials = new System.Net.NetworkCredential("webmaster@ayanova.com", "c63c17add818fca81cae71a241ea1b552675a86280b7e7e45d36cbf2e8f3bc0e");
smtpClient.Send(message);
}
}
// smtpClient.Host = "smtp.fastmail.com";
// smtpClient.Port = 587;
// smtpClient.UseDefaultCredentials = false;
// smtpClient.EnableSsl=true;
// //NOTE: Do not use the noreply email address to send mail, it crashes the server somehow
// smtpClient.Credentials = new System.Net.NetworkCredential("support@onayanova.com", "cnea8agl6nlx5j7l");
// smtpClient.Send(message);
// }
// }
}
@@ -143,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)
{
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;
}
// string JSONres = res.Content.ReadAsStringAsync().Result;
// dynamic JSONdata = JObject.Parse(JSONres);
// if (JSONdata.success != "true")
// {
// return false;
// }
string JSONres = res.Content.ReadAsStringAsync().Result;
dynamic JSONdata = JObject.Parse(JSONres);
if (JSONdata.success != "true")
{
return false;
}
return true;
}
// return true;
// }
}

105
Pages/Request.cshtml Normal file
View File

@@ -0,0 +1,105 @@
@page
@model RequestModel
@{
ViewData["Title"] = "Request";
}
<div class="container">
<div class="jumbotron text-center">
<h2>Request AyaNova subscription 7 day trial account</h2>
</div>
<div>
<form class="form form-horizontal" method="post">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label asp-for="SubRequest.Name" class="col-md-3 right">Name:</label>
<div class="col-md-9">
<input asp-for="SubRequest.Name" class="form-control" required autofocus />
<span asp-validation-for="SubRequest.Name"></span>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label asp-for="SubRequest.Company" class="col-md-3 right">Company:</label>
<div class="col-md-9">
<input asp-for="SubRequest.Company" placeholder="Your Company Name" class="form-control"
required />
<span asp-validation-for="SubRequest.Company"></span>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label asp-for="SubRequest.Email" class="col-md-3 right">Email:</label>
<div class="col-md-9">
<input asp-for="SubRequest.Email" placeholder="email@you.com" class="form-control"
required />
<span asp-validation-for="SubRequest.Email"></span>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label asp-for="SubRequest.DataCenter" class="col-md-3 right">Data center (closest to
you):</label>
<div class="col-md-9">
<select asp-for="SubRequest.DataCenter" asp-items="Model.DataCenters"></select>
<span asp-validation-for="SubRequest.DataCenter"></span>
</div>
</div>
</div>
</div>
<!-- Button -->
<!-- <div class="form-group">
<label class="col-md-4 control-label" for="Send"></label>
<div class="col-md-4">
<div class="g-recaptcha" data-callback="imNotARobot"
data-sitekey="6LcH7GUUAAAAAJIDf_JDZolSv__xN6oqr9Dx79zs">
</div>
<button id="btnsubmit" type="submit" class="btn btn-info">Send us your request</button>
</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>
</form>
</div>
<!--start bottom container-->
<div class="container text-center">
<div class="row">
<hr>
<small><span>Ground Zero Tech-Works, Inc</span>
<br>
<span><a href="https://ayanova.com/r/privacy.htm">Privacy Policy</a></span></small>
</div>
</div>
<!--end bottom container-->

228
Pages/Request.cshtml.cs Normal file
View File

@@ -0,0 +1,228 @@
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc.RazorPages;
using System.ComponentModel.DataAnnotations;
using Microsoft.AspNetCore.Mvc;
using System.Net.Mail;
using System.Net;
//for captcha:
using System.Net.Http;
using Newtonsoft.Json.Linq;
using Microsoft.Extensions.Configuration;
using Microsoft.AspNetCore.Mvc.Rendering;
namespace contact.Pages
{
[BindProperties(SupportsGet = true)]
public class RequestFormModel
{
public RequestFormModel()
{
DataCenter = "SF";
}
[Required]
public string Name { get; set; }
[Required]
public string Company { get; set; }
[Required, EmailAddress]
public string Email { get; set; }
[Required]
public string DataCenter { get; set; }
}
public class RequestModel : PageModel
{
// public string DataCenter { get; set; }
[BindProperty(SupportsGet = true)]
public RequestFormModel SubRequest { get; set; }
public List<SelectListItem> DataCenters { get; } = new List<SelectListItem>
{
new SelectListItem { Value = "SF", Text = "San Francisco" },
new SelectListItem { Value = "NY", Text = "New York" },
new SelectListItem { Value = "TOR", Text = "Toronto" },
new SelectListItem { Value = "AMS", Text = "Amsterdam" },
new SelectListItem { Value = "LON", Text = "London" },
new SelectListItem { Value = "FFT", Text = "Frankfurt" },
new SelectListItem { Value = "SNG", Text = "Singapore" },
new SelectListItem { Value = "BNG", Text = "Bangalore" },
new SelectListItem { Value = "SYD", Text = "Sydney Australia" }
};
private readonly IConfiguration _configuration;
public RequestModel(IConfiguration configuration)
{
_configuration = configuration;
}
public ActionResult OnPost()
{
if (!ModelState.IsValid)
{
return Page();
}
//2025-11-01 Google dropping support for captcha, just nuking it for now, see how much spam I get
// if (!ReCaptchaPassed(
// 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);
// }
//fuck those spammers
//2022-05-06 changes to get rid of jumbo lead magnet spammer but still force him to pay someone to manually enter the stuff
//ideally it should read from a text file here but this is a quickie fix while Joyce is on important viha phone call
var blocks = new List<string>();
blocks.Add("google");
blocks.Add("jumboleadmagnet");//<--fuck this guy in particular, keeps spamming
blocks.Add("boostleadgeneration");
//ericjonesmyemail@gmail.com
var companyname = SubRequest.Company.ToLowerInvariant();
foreach (string s in blocks)
{
if (companyname.Contains(s))
{
goto skipspam;
}
}
PostRequestToSockeye();
SendMail();
skipspam:
return Redirect("https://ayanova.com/docs/ay-evaluate/");
}
private void PostRequestToSockeye()
{
using var client = new HttpClient();
//client.BaseAddress = new System.Uri("https://sockeye.ayanova.com");///api/v8.0/subscription-server/
var r = new
{
dataCenter = SubRequest.DataCenter,
email = SubRequest.Email,
company = SubRequest.Company,
name = SubRequest.Name,
rValue = "totallylegit"
};
HttpContent body = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(r),
System.Text.Encoding.UTF8,
"application/json");
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;
// if (response.IsSuccessStatusCode)
// {
// var content = await response.Content.ReadAsStringAsync();
// if (!string.IsNullOrEmpty(content))
// {
// var objDeserializeObject = JsonConvert.DeserializeObject<SongsModel>(content);
// Console.WriteLine("Data Saved Successfully.");
// if (objDeserializeObject != null)
// {
// Console.WriteLine(objDeserializeObject.Name);
// }
// }
// }
}
private void SendMail()
{
var MessageBody = $"Name:\r\n{SubRequest.Name}\r\n\r\nCompany:\r\n{SubRequest.Company}\r\n\r\nDataCenter:\r\n{SubRequest.DataCenter}";
//SEND TO US
using (var message = new MailMessage())
{
message.To.Add(new MailAddress("support@ayanova.com"));
message.From = new MailAddress(SubRequest.Email);
message.Subject = $"Trial request from {SubRequest.Company}";
message.Body = MessageBody;
using (var smtpClient = new SmtpClient("smtp.fastmail.com"))
{
smtpClient.Host = "smtp.fastmail.com";
smtpClient.Port = 587;
smtpClient.UseDefaultCredentials = false;
//testing
smtpClient.EnableSsl = true;
// smtpClient.Port=465;
// smtpClient.DeliveryMethod= SmtpDeliveryMethod.Network;
//NOTE: Do not use the noreply email address to send mail, it crashes the server somehow
//******************************************************************************************************************
//******************************************************************************************************************
//TEST CRASH
// smtpClient.Credentials = new System.Net.NetworkCredential("noreply@ayanova.com", "91768700489f8edd28aa71e3e0f4073eba54ce83c4c1a6a910700fa94094ddfd");
//FASTMAIL CHANGES
//Fastmail server names and ports help page: https://www.fastmail.help/hc/en-us/articles/1500000278342
//APP Password created in fastmail for smtp use only labelled 'contact-form': cnea8agl6nlx5j7l
//try using from as support@onayanova.com
//try domain version if this still won't work
smtpClient.Credentials = new System.Net.NetworkCredential("support@onayanova.com", "cnea8agl6nlx5j7l");
//******************************************************************************************************************
//******************************************************************************************************************
smtpClient.Send(message);
}
}
}
public void OnGet()
{
}
//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;
// }
// string JSONres = res.Content.ReadAsStringAsync().Result;
// dynamic JSONdata = JObject.Parse(JSONres);
// if (JSONdata.success != "true")
// {
// return false;
// }
// return true;
// }
}
}

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>

28
notes
View File

@@ -1,25 +1,21 @@
todo: captcha
https://developers.google.com/recaptcha/intro
CAPTCHA 2
https://retifrav.github.io/blog/2017/08/23/dotnet-core-mvc-recaptcha/
Secret key: 6LcH7GUUAAAAAERHuA3fWDcMIlJ3QHE_WNZm4BSO
Site key: 6LcH7GUUAAAAAJIDf_JDZolSv__xN6oqr9Dx79zs
$Profit
//empty publish folder then...
dotnet publish -c Release -o ./../publish/ --no-self-contained -r linux-x64
copy up to server
.NET Core apps: /var/aspnetcore
backup last contact in contact.last folder
remove all files from contact.last
then cp -a ../contact/. .
, then to restart the service do this:
copy up to server
.NET Core apps: /srv/coreapps/contact
, then to restart the service do restart:
systemctl restart kestrel-contact.service
systemctl status kestrel-contact.service
systemctl start kestrel-contact.service
systemctl stop kestrel-contact.service
systemctl stop kestrel-contact.service

11
rest-test.http Normal file
View File

@@ -0,0 +1,11 @@
POST https://sockeye.ayanova.com/subscription-server-trial-request HTTP/1.1
content-type: application/json
{
"dataCenter":"SubRequest.DataCenter",
"email":"SubRequest.Email",
"company":"SubRequest.Company",
"name":"SubRequest.Name",
"rValue":"totallylegit"
}