6f835ada9e14b5eaeee7084092f2cd3e4e0211a4 chinhli Tue Jun 11 07:44:57 2013 -0700 CAPTCHA enabled per Jonathan's suggestion diff --git src/hg/hgUserSuggestion/hgUserSuggestion.c src/hg/hgUserSuggestion/hgUserSuggestion.c index f7b4b3d..db30419 100644 --- src/hg/hgUserSuggestion/hgUserSuggestion.c +++ src/hg/hgUserSuggestion/hgUserSuggestion.c @@ -101,31 +101,31 @@ " name=\"suggestCfmEmail\" id=\"cfmemail\" size=\"50\" /><BR> \n"); hPrintf( " <label for=\"category\">Category:</label><select name=\"suggestCategory\" id=\"category\">\n" " <option selected>New feature request</option> \n" " <option>New utilities request</option>\n" " <option>New/Update genome request</option>\n" " <option>New track request</option>\n" " <option>Others</option>\n" " </select><BR>\n"); hPrintf( " <label for=\"summary\">Summary:</label><input type=\"text\" name=\"suggestSummary\" id=\"summary\" size=\"50\" /><BR>\n" " <label for=\"details\">Details:</label><BR><textarea name=\"suggestDetails\" id=\"details\" cols=\"100\" rows=\"10\"></textarea><BR> \n" " </div>\n"); hPrintf( " <p>\n" - " <label for=\"code\">Write CAPTCHA security code below (disabled) > <span id=\"txtCaptchaDiv\" style=\"color:#F00\"></span><BR><!-- this is where the script will place the generated code --> \n" + " <label for=\"code\">Write CAPTCHA security code below > <span id=\"txtCaptchaDiv\" style=\"color:#F00\"></span><BR><!-- this is where the script will place the generated code --> \n" " <input type=\"hidden\" id=\"txtCaptcha\" /></label><!-- this is where the script will place a copy of the code for validation: this is a hidden field -->\n" " <input type=\"text\" name=\"txtInput\" id=\"txtInput\" size=\"30\" />\n" " </p>\n"); hPrintf( " <div class=\"formControls\">\n" " <input id=\"sendButton\" type=\"button\" value=\"Send\" onclick=\"submitform()\"/> \n" " <input type=\"reset\" name=\"suggestClear\" value=\"Clear\" class=\"largeButton\"> \n" " <input type=\"cancel\" name=\"Cancel\" value=\"Cancel\" class=\"largeButton\">\n" " </div>\n" " \n" " </FORM>\n\n"); } void printValidateScript() /* javascript to validate form inputs */ { @@ -189,35 +189,35 @@ " } \n" " return true;\n" " }\n" " </script><br />\n\n"); } void printCheckCaptchaScript() /* javascript to check CAPTCHA code */ { hPrintf( " <script type=\"text/javascript\">\n" " function checkCaptcha(theform){\n" " var why = \"\";\n" " \n" " if(theform.txtInput.value == \"\"){\n" - " why += \"- Security code should not be empty.\n\";\n" + " why += \"- Security code should not be empty.\";\n" " }\n" " if(theform.txtInput.value != \"\"){\n" " if(ValidCaptcha(theform.txtInput.value) == false){\n" - " why += \"- Security code did not match.\n\";\n" + " why += \"- Security code did not match.\";\n" " }\n" " }\n" " if(why != \"\"){\n" " alert(why);\n" " theform.txtInput.focus() ;\n" " return false;\n" " }\n" " return true;\n" " }\n\n"); hPrintf( " var a = Math.ceil(Math.random() * 9)+ '';\n" " var b = Math.ceil(Math.random() * 9)+ '';\n" " var c = Math.ceil(Math.random() * 9)+ '';\n" " var d = Math.ceil(Math.random() * 9)+ '';\n" " var e = Math.ceil(Math.random() * 9)+ '';\n\n" @@ -236,32 +236,31 @@ " }\n\n"); hPrintf( " function removeSpaces(string){\n" " return string.split(' ').join('');\n" " }\n" " </script><br />\n\n"); } void printSubmitFormScript() /* javascript to submit form */ { hPrintf( " <script type=\"text/javascript\">\n" " function submitform()\n" " {\n" - " if ( validateMainForm(document.forms[\"mainForm\"]) )\n" -// " if ( validateMainForm(document.forms[\"mainForm\"]) && checkCaptcha(document.forms[\"mainForm\"]))\n" + " if ( validateMainForm(document.forms[\"mainForm\"]) && checkCaptcha(document.forms[\"mainForm\"]))\n" " {\n" " document.forms[\"mainForm\"].submit();\n" " }\n" " }\n" " </script>\n\n"); } void printSuggestionConfirmed() { hPrintf( "<h2>Thank you for your suggestion!</h2>"); hPrintf( "<p>" "Thank you for your suggestion regarding the UCSC Genome Browser.<BR>" "A confirmation mail has send to you containing an unique suggestion ID,<BR>"