public function verifySubmission()
 {
     if (craft()->httpSession->get('invisibleCaptchaDuplicateId')) {
         // If there is a valid unique token set, unset it and return true.
         craft()->httpSession->remove('invisibleCaptchaDuplicateId');
         return true;
     } else {
         SproutInvisibleCaptchaPlugin::log("A form submission failed the Duplicate Submission test.", LogLevel::Info, true);
         // If there is no token set fail the method to prevent duplicate submission, log in the database, and return false
         craft()->sproutInvisibleCaptcha->duplicateMethodFailed = 1;
         return false;
     }
 }
 public function verifySubmission()
 {
     $jsset = craft()->request->getPost('__JSCHK');
     if (strlen($jsset) > 0) {
         // If there is a valid unique token set, unset it and return true.
         // This token was created and set by javascript.
         craft()->httpSession->remove('invisibleCaptchaJavascriptId');
         return true;
     } else {
         SproutInvisibleCaptchaPlugin::log("A form submission failed because the user did not have Javascript enabled.", LogLevel::Info, true);
         // If there is no token, set to fail; javascript is not present
         craft()->sproutInvisibleCaptcha->javascriptMethodFailed = 1;
         return false;
     }
 }
 public function verifySubmission()
 {
     $time = time();
     $posted = (int) craft()->request->getPost('__UATIME', time());
     // Time operations must be done after values have been properly assigned and casted
     $diff = $time - $posted;
     $min = (int) $this->getMinElapsedTime();
     // Flag it as a spammy submission based on time
     // @TODO: May convert the minElapsedTime into a global setting
     $verified = (bool) ($diff > $min);
     if ($verified) {
         return true;
     } else {
         SproutInvisibleCaptchaPlugin::log("A form submission failed because the form was submitted too quickly. The form requires the user to take a minimum of " . $min . "seconds and the form was submitted in: " . $diff . " seconds", LogLevel::Info, true);
         craft()->sproutInvisibleCaptcha->timeMethodFailed = 1;
         return false;
     }
 }
 public function verifySubmission()
 {
     $uahash = craft()->request->getPost('__UAHASH');
     $uahome = craft()->request->getPost('__UAHOME');
     // Run a user agent check
     if (!$uahash || $uahash != $this->getUaHash()) {
         SproutInvisibleCaptchaPlugin::log("A form submission failed because the the user agent did not match.", LogLevel::Info, true);
         craft()->sproutInvisibleCaptcha->originMethodFailed = 1;
         return false;
     }
     // Run originating domain check
     if (!$uahome || $uahome != $this->getDomainHash()) {
         SproutInvisibleCaptchaPlugin::log("A form submission failed because the domain did not match.", LogLevel::Info, true);
         craft()->sproutInvisibleCaptcha->originMethodFailed = 1;
         return false;
     }
     // Passed
     return true;
 }
 public function verifySubmission()
 {
     // @TODO - clean up the way we access settings
     $honeypotFieldName = craft()->sproutInvisibleCaptcha->getMethodOption('honeypotFieldName');
     $honeypotUseDatabase = craft()->sproutInvisibleCaptcha->getMethodOption('honeypotUseDatabase');
     $honeypotRequireJavascript = craft()->sproutInvisibleCaptcha->getMethodOption('honeypotRequireJavascript');
     if ($honeypotRequireJavascript) {
         $length = strlen($honeypotFieldName);
         foreach (craft()->request->getPost() as $key => $value) {
             if (substr($key, 0, $length) === $honeypotFieldName) {
                 $honeypotFieldName = $key;
             }
         }
     }
     // The honeypot field must be left blank
     if ($honeypotValue = craft()->request->getPost($honeypotFieldName)) {
         SproutInvisibleCaptchaPlugin::log("A form submission failed the Honeypot test.", LogLevel::Info, true);
         craft()->sproutInvisibleCaptcha->honeypotMethodFailed = 1;
         return false;
     }
     return true;
 }