Skip to content

Add InfoPeak Captcha as a captcha type - #3729

Open
infopeak wants to merge 1 commit into
Strategy11:masterfrom
infopeak:infopeak-captcha
Open

infopeak wants to merge 1 commit into
Strategy11:masterfrom
infopeak:infopeak-captcha

Conversation

@infopeak

@infopeak infopeak commented Nov 21, 2026 •

Copy link
Copy Markdown

Adds InfoPeak Captcha as a fourth captcha type next to reCAPTCHA, hCaptcha and Turnstile, following the existing provider pattern.

  • FrmInfopeakSettings extends FrmFieldCaptchaSettings and is registered in FrmCaptchaFactory. New infopeak_pubkey/infopeak_privkey settings, plus a tab and panel in Captcha/Spam settings.
  • Tokens are verified with InfoPeak's reCAPTCHA compatible /siteverify (secret, response, remoteip in, success and error-codes out), so validate_against_api(), the error messages and the spam handling are reused unchanged.

Points worth a look:

  • formidable.js (and the regenerated formidable.min.js): after an AJAX submit with errors the widget is reset like the other providers, since tokens are single use. When a form is shown again after an AJAX submit, the widget renders itself again: print_ajax_scripts() already reprints captcha-api, and the loader renders any new .infopeak-captcha element.
  • quota-exceeded (the site's monthly quota is used up) is treated as a configuration error, since retrying cannot help.
  • The widget has one size and theme, so the size and theme field options are hidden. Builder placeholder: images/infopeak.png.
  • Tests: test_FrmCaptchaFallback now includes infopeak, and a new test in test_FrmCaptchaSpam covers the siteverify request and the used up quota.
  • No changes to existing behaviour.

Why: InfoPeak Captcha is EU-hosted and sets no cookies. The visitor's browser solves a small proof-of-work challenge while the form is filled in, so there are no image puzzles. The free tier covers 10,000 verifications per month and stays free.

Tested on WordPress 7.1.5 / PHP 8.3 with Formidable Lite from this branch: normal and AJAX submit (including the form shown again), tampered, reused and missing tokens rejected and not saved, AJAX error then reset and resubmit, two AJAX forms on one page, switching captcha type in settings and back, the builder field, 375 and 1280 px. phpcs (whole repo), PHPStan, php-cs-fixer, rector, eslint and the JS unit tests pass. PHPUnit: 1350 of 1351 pass; test_front_head needs WP core assets built, which I skipped locally.

Summary by CodeRabbit

  • New Features
    • Added InfoPeak CAPTCHA as a supported option alongside existing CAPTCHA providers.
    • Added settings for InfoPeak site and secret keys, plus provider-specific verification and error handling.
    • InfoPeak CAPTCHA resets after form submission errors when its script is available.

Adds InfoPeak Captcha next to reCAPTCHA, hCaptcha and Turnstile, built
on the same FrmFieldCaptchaSettings pattern as the other providers.
Tokens are verified with the reCAPTCHA compatible siteverify endpoint,
so the existing validation and spam handling are reused unchanged.
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

InfoPeak is added as a CAPTCHA provider. The change adds provider settings, script URL routing, verification handling, and settings-page controls. Tests cover provider selection and fallback, rendering and script loading, and successful or quota-exceeded verification responses.

Changes: InfoPeak CAPTCHA integration

Layer / File(s) Summary
Provider settings and registration
classes/models/FrmInfopeakSettings.php, classes/models/FrmSettings.php, classes/factories/FrmCaptchaFactory.php
Adds the InfoPeak settings class, public and private keys, provider detection, and factory mapping. The settings class defines the verification endpoint and provider-specific error handling.
Script loading and verification
classes/models/fields/FrmFieldCaptcha.php, js/formidable.js, tests/phpunit/fields/test_FrmCaptchaSpam.php
Routes InfoPeak to its filtered script URL and resets InfoPeak CAPTCHA elements on AJAX errors when the global is available. The new test checks verification credentials, token, and quota-exceeded handling.
Provider selection and settings display
classes/views/frm-settings/captcha/captcha.php, tests/phpunit/settings/test_FrmCaptchaFallback.php
Adds InfoPeak to the CAPTCHA selector and settings panel. The tests include InfoPeak in provider fallback, supported-provider, rendering, and script-loading checks.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  actor Admin
  participant CaptchaSettings as CAPTCHA settings UI
  participant FrmFieldCaptcha
  participant Browser
  participant InfoPeakScript as InfoPeak script
  participant FrmInfopeakSettings
  participant Siteverify as InfoPeak siteverify endpoint

  Admin->>CaptchaSettings: Select InfoPeak and configure keys
  FrmFieldCaptcha->>Browser: Provide the InfoPeak script URL
  Browser->>InfoPeakScript: Load script and render CAPTCHA elements
  Browser->>FrmInfopeakSettings: Submit CAPTCHA response token
  FrmInfopeakSettings->>Siteverify: Send secret and token
  Siteverify-->>FrmInfopeakSettings: Return verification result
Loading

Possibly related PRs

  • Strategy11/formidable-forms#3690: Updates fallback behavior for saved CAPTCHA providers. Its supported-provider list is related to adding InfoPeak as another supported provider.

Suggested reviewers: crabcyborg

Merge Risk: Minimal · up to 3f7af

This adds InfoPeak as a fourth captcha provider using the existing provider pattern, with reused validation and spam handling. No concrete defect was found in the change, so merge readiness risk is minimal. The unattributed DeepSource JavaScript check failure is worth a quick look before merging.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Add InfoPeak Captcha as a captcha type" matches the main change. The changeset adds InfoPeak as a fourth captcha provider. It adds FrmInfopeakSettings, registers it in FrmCaptchaFactory, ad…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Add InfoPeak Captcha as a captcha type" matches the main change. The changeset adds InfoPeak as a fourth captcha provider. It adds FrmInfopeakSettings, registers it in FrmCaptchaFactory, adds key settings, and adds a settings panel. The title is short, specific, and free of file lists or vague terms.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
Fix failing CI checks

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

⚠️ This pull request has been flagged as potential spam (promotional) by CodeRabbit slop detection and should be reviewed carefully.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 7f27c41 and 3f7afb6.

Files ignored due to path filters: 2

  • images/infopeak.png is excluded by !**/*.png
  • js/formidable.min.js is excluded by !**/*.min.js
Files selected for processing: 8

  • classes/factories/FrmCaptchaFactory.php
  • classes/models/FrmInfopeakSettings.php
  • classes/models/FrmSettings.php
  • classes/models/fields/FrmFieldCaptcha.php
  • classes/views/frm-settings/captcha/captcha.php
  • js/formidable.js
  • tests/phpunit/fields/test_FrmCaptchaSpam.php
  • tests/phpunit/settings/test_FrmCaptchaFallback.php

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@deepsource-io

deepsource-io Bot commented Nov 21, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 7f27c41...3f7afb6 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

Code Review Summary

Analyzer Status Updated (UTC) Details
PHP Nov 21, 2026 9:52a.m. Review ↗
JavaScript Nov 21, 2026 9:52a.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

@deepsource-io

deepsource-io Bot commented Nov 21, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 7f27c41...3f7afb6 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

Important

Some issues found as part of this review are outside of the diff in this pull request and aren't shown in the inline review comments due to GitHub's API limitations. You can see those issues on the DeepSource dashboard.

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
PHP Nov 21, 2026 9:52a.m. Review ↗
JavaScript Nov 21, 2026 9:52a.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

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