andrewlimaza / caldera-forms-anti-spam

Caldera Forms Anti Spam WordPress plugin. This adds Google's reCAPTCHA field to your Caldera Form.
https://wordpress.org/plugins/cf-anti-spam/
25 stars 16 forks source link

Migrate "execute" until just before form submit #20

Open ecaron opened 4 years ago

ecaron commented 4 years ago

The current implementation of grecaptcha.execute causes 2 problems:

If we could adjust this plugin to block the caldera form submission, then execute the grecaptcha, then let the submission continue, the problem should go away.

The code in question is at https://github.com/andrewlimaza/caldera-forms-anti-spam/blob/a43164965aab9e30bc08f8e4f77cbd6ed84ab63a/fields/recaptcha/field.php#L58

ecaron commented 4 years ago

I'm working on a PR. My current idea involves https://calderaforms.com/doc/validation-events/ and modifying the state of obj.inst.validationResult to "wrap" the call.

ecaron commented 4 years ago

Here's a gist that represents what I have in mind: https://gist.github.com/ecaron/da9087482b0cdfa587f762a608bb43cf Notable changes:

ecaron commented 4 years ago

The gist has been updated (https://gist.github.com/ecaron/da9087482b0cdfa587f762a608bb43cf):

ecaron commented 4 years ago

PR has been submitted: https://github.com/andrewlimaza/caldera-forms-anti-spam/pull/21

sburlot commented 4 years ago

PR #21 solved the "reset captcha" for me. Hope this goes to the next update.

ecaron commented 3 years ago

@andrewlimaza - any update on this?