There was a bug in the code that handles the invisible ReCaptcha that
was preventing the forms from working when this setting is activated and
the user submits a form that is not the first form on the page.
The code that calls the ReCaptcha API when the invisible ReCaptcha is
used was not passing the ID of the ReCaptcha instance. This meant that
for all the forms, ReCaptcha would call the callback associated with the
first form. That is why the other forms were not working.
The fix was simply making sure we pass the ReCaptcha ID when we call
grecaptcha.execute().
[MAILPOET-4145]
This commit makes sure we reset the ReCaptcha when there is an error so
that the form continues to work and that the user can fix the error and
submit the form again. This was affecting only the invisible ReCaptcha.
For more information on the problem that is fixed by this commit, see
https://github.com/mailpoet/mailpoet/pull/4084#pullrequestreview-959001922
[MAILPOET-4145]
This commit changes the logic to display the link to sign up for
ReCaptcha API keys in the advanced settings page. Before the link was always
visible, now it will be visible only if one of the two supported
ReCaptcha checks are selected.
[MAILPOET-4145]
This commit renames two variables to make it easier to understand the
code responsible for adding a ReCapcha to a subscription form:
formData.recaptcha -> formData.recaptchaWidgetId
formData.data.recaptcha -> formData.data.recaptchaResponseToken
Before this change it was harder to understand the difference between
formData.recaptcha and formData.data.recaptcha since they used the same
name.
[MAILPOET-4145]
The original code that added suport for the invisible ReCaptcha assumed
an HTML structure for all the subscription forms that was invalid.
Different forms can have slightly different HTML structures. This meant
that the original code worked for some forms, but not for others.
This commit changes the jQuery selectors needed for the invisible
ReCaptcha to work to be more lenient (to search for a given element
in more than one level in the DOM tree) and to function on different
HTML structures.
[MAILPOET-4145]
This commit adds the required code to display the invisible ReCaptcha in
the frontend when a form is rendered and this type of captcha is
selected in the admin.
[MAILPOET-4145]
This commit simply moves four functions to the top of the public.jsx
file to satisfy the no-use-before-define ESLint rule. This is necessary
for some changes that will be implemented in a subsequent commit to
add support for the invisible ReCaptacha. I'm doing them in a separate
commit to make the review process easier.
[MAILPOET-4145]
This commit adds a new option to let users select ReCaptcha v2 Invisible
when using a captcha in the forms. Before we supported only ReCaptcha
v2 Checkbox.
It introduces a new option to the Advanced settings screen where users
can enter the keys for this type of ReCaptcha. Support for rendering
this type of captch in the frontend will be added in a future commit.
[MAILPOET-4145]
If the default collation of database would vary from the one
from created tables it would cause the temp table created to
have a different collation than the main tables
[MAILPOET-4251]