1471dd6785665dbe477cbfd128fde779f40e046c
hiram
  Thu Jun 22 11:28:54 2023 -0700
add specific message for users that fail the captcha test refs #31325

diff --git src/hg/hgUserSuggestion/hgUserSuggestion.c src/hg/hgUserSuggestion/hgUserSuggestion.c
index 2604eb8..0648a97 100644
--- src/hg/hgUserSuggestion/hgUserSuggestion.c
+++ src/hg/hgUserSuggestion/hgUserSuggestion.c
@@ -375,43 +375,66 @@
      refID, userAddr);
 hPrintf(
     "<p><a href=\"hgUserSuggestion\">Click here if you wish to make additional suggestions.</a></p>");
 hPrintf(
     "<p>"
     "<B>Your suggestion summary:</B><BR>"
     "%s<BR>"
     "<B>Your suggestion details:</B><BR>"
     "<pre>%s</pre>"
     "</p>",
     summary, details);
 if (captchaScore > -1.0)
     hPrintf("<p>(google captcha score: %g)</p>\n", captchaScore);
 }
 
-void printInvalidForm(double captchaScore)
+void printInvalidForm(double captchaScore, boolean robot)
 /* display invalid form page */
 {
-hPrintf(
-    "<h2>Invalid Form.</h2>");
 if (captchaScore > -1.0)
+    {
+    if (robot)
+	{
+        char *sName=cartUsualString(cart,"suggestName","no name entered");
+        char *sEmail=cartUsualString(cart,"suggestEmail","no email entered");
+        char *sCategory=cartUsualString(cart,"suggestCategory","no category entered");
+        char *sSummary=cartUsualString(cart,"suggestSummary","no summary entered");
+        char *sDetails=cartUsualString(cart,"suggestDetails","no details entered");
 	hPrintf(
+        "<h2>Invalid Form.</h2>"
+	"<p>"
+	"Congratulations, your google captcha score (%g) appears to qualify "
+        "you as a robot.  If this is in error, please email our support email:"
+        "&nbsp;<a href='mailto:hclawson@ucsc.edu?subject=suggestion "
+        "failed captcha&body=Failed captcha test in suggestion form, "
+        "score: %g, %s, %s, %s, %s, %s'>help me Mr. Wizard !</a>"
+	"</p>", captchaScore, captchaScore, sName, sEmail, sCategory, sSummary, sDetails
+	);
+	}
+    else
+	{
+	hPrintf(
+        "<h2>Invalid Form.</h2>"
 	"<p>"
 	"The form is invalid. Please correct it and "
 	"<a id='goBack' >submit</a> again. (score: %g)</p>", captchaScore
 	);
+	}
+    }
 else
     hPrintf(
+        "<h2>Invalid Form.</h2>"
 	"<p>"
 	"The form is invalid. Please correct it and "
 	"<a id='goBack' >submit</a> again.</p>"
     );
 jsOnEventById("click", "goBack", "history.go(-1)");
 }
 
 void printInvalidCategory(char *invalidCategory)
 /* display invalid category page */
 {
 hPrintf(
     "<h2>Invalid Category.</h2>");
 hPrintf(
     "<p>"
     "The category \"%s\" is invalid. Please correct it and "
@@ -574,31 +597,31 @@
     else
 	recordError(captchaScore, "reCaptchaToken not found in form", NULL);
     }	// if (isNotEmpty(cfgOption(CFG_SUGGEST_SECRET_KEY)))
 
 char *sEmail=cartUsualString(cart,"suggestEmail","");
 char *sCategory=cartUsualString(cart,"suggestCategory","");
 char *sSummary=cartUsualString(cart,"suggestSummary","");
 char *sDetails=cartUsualString(cart,"suggestDetails","");
 char *sWebsite=cartUsualString(cart,"suggestWebsite","");
 char suggestID[512];
 safef(suggestID, sizeof(suggestID),"%s %s", sEmail, now());
 
 /* reject if the hidden field is not blank */
 if (isNotEmpty(sWebsite) || captchaRobot)
     {
-    printInvalidForm(captchaScore);
+    printInvalidForm(captchaScore, captchaRobot);
     cartSetString(cart, "suggestWebsite", "");
     return;
     }
 
 /* reject suggestion if category is invalid */
 if (!validateCategory(sCategory))
     {
     printInvalidCategory(sCategory);
     return;
     }
 
 /* Send back suggestion only with valid user email address */
 if (spc_email_isvalid(sEmail) != 0)
     {
     /* send back the suggestion */