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]
This commit deprecates the following Models\Newsletter methods:
- \MailPoet\Models\Newsletter::filterType()
- \MailPoet\Models\Newsletter::getWelcomeNotificationsForSegments()
- \MailPoet\Models\Newsletter::duplicate()
I'm doing this as part of a ticket to replace the models
NewsletterOption and NewsletterOptionField with Doctrine code. The
methods deprecated here use those models. But since they are not used
anymore in our codebase, I figured it would be easier to deprecate them
instead of replacing the models.
[MAILPOET-4150]
This commit replaces old Paris code with Doctrine entities in
SubscriberTest::_after() and it also truncate only the entities that are
actually used inside the test class. Before this change, the class was
unnecessarily truncating entities that were not used. I'm doing this
commit as part of task to remove all usages of the old NewsletterOption
model and that is why I'm not touching the remaining models in other
methods of this class.
[MAILPOET-4150]
While removing some deprecated models in the commit
a525b96f16, I noticed that we maintain a
list of tables that needs to be truncated before running the integration
tests. To make it easier when removing future models and to make sure
the list of tables is always updated, in this commit, I'm removing the
manual list and changing the code to dynamically get the tables and
truncate them.
The code that I removed from _bootstrap.php, meant that PHPStan error
was not present anymore, so it was possible to update its baseline files
to remove the ignores for that error.
[MAILPOET-4325]