Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Procatcha support #786

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Procatcha support #786

wants to merge 3 commits into from

Conversation

light-source
Copy link

Hello Danny!

I'm Maxim Akimov, a WordPress plugin developer. I collaborate with the Prosopo team and I am responsible for the integration with your plugin. (here is the related WP support thread)

After getting familiar with the plugin architecture, I have done the following:

  1. Introduced a new item in your existing integrations for handling the Procaptcha settings
  2. Added a new form field type (button) in the JS code (that injects a hidden input into the form)
  3. Added the captcha element & API call as a separate class of the newly introduced integration
  4. Added the Procaptcha setup status to the general settings (with a link to the integration page)

Let me briefly explain the reasons behind the key decisions:

1. New integration

I opted for the new integration as it allows us to keep the vast of the integration code independent, without changing the core code.

Making all the Procaptcha settings part of the general settings would stretch them and could distract users while adding as part of form settings would require filling the same data multiple times.

The added 'Procaptcha status' to the general settings simplifies the navigation while keeping the settings short.

2. Procaptcha field type

I opted for the button, as unlike auto-injection it allows users not just to enable or disable the captcha for specific forms, but also precisely control its position in the form.

Meanwhile, the field button uses the existing setup and just adds a hidden input. This input is replaced with the real captcha element during rendering.

It allowed me to avoid big changes in the JS code while having a captcha element dynamic. It means if in the future we've something to change or improve in the element, we won't have the compatibility issue, as it would be in the case with the static HTML.

For the new and modified code, I setup IDE with CodeSniffer to follow your phpcs.xml rules.

Please review the PR, and let me know if you've any notes or concerns. I'm also open to changing the chosen integration approach, in case you don't like it.

Best regards,
Maxim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant