Repository navigation
Turn off IP matching by default (setting), fix User Registration AJAX login and Spectra with several forms - #68
Merged
Conversation
…lookup with several forms
- User Registration's AJAX login posts only its own fields, so the
wp_authenticate_user check never saw procaptcha-response and rejected
every login. A jQuery prefilter now adds the token from the login form,
and a failed login resets the widget.
- Spectra reads hidden fields via getElementById('hidden'), which returns
the first match on the page, so a second Spectra form (or one with its
own hidden field first) sent the wrong or no token. Our input no longer
has that id; a hidden element whose id is the field name lets Spectra's
per-form loop send the form's own value.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sending `ip` to /siteverify turns on IP matching, which rejects real visitors when the IP differs from the one that solved the captcha. Most sites are behind Cloudflare, where REMOTE_ADDR is Cloudflare's address, so 1.23.0's default could reject legitimate submissions. - New "Visitor IP matching" select on the General tab, off by default: Cloudflare (CF-Connecting-IP), another proxy (first X-Forwarded-For address) or a direct connection (REMOTE_ADDR). - The prosopo/procaptcha/visitor_ip filter now receives the IP from that setting (empty when off) plus REMOTE_ADDR, and can still override it. - Unit tests for each source, the default and the filter. - Translations for the new strings in de, es, fr, it and pt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The widget calls error-callback for failed background requests too (e.g. the detector bundle or frictionless calls to the provider), which don't invalidate a token the visitor already has. Clearing our custom input on those emptied valid tokens in JS-driven forms; CI hit this with Formidable whenever the provider was unreachable. Expiry and reset still clear it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
IP matching: off by default, now a setting
1.23.0 sent the visitor's IP (
REMOTE_ADDR) to/siteverify, which turns on IP matching. On sites behind Cloudflare,REMOTE_ADDRis Cloudflare's address, so real visitors could be rejected.CF-Connecting-IP)X-Forwarded-Foraddress)REMOTE_ADDR)prosopo/procaptcha/visitor_ipnow receives($ip_from_setting, $remote_addr), where the first value is empty when the setting is off. It can still override the result.User Registration: AJAX login always failed the captcha check
With "AJAX login" on,
ur-login.jsposts only its own fields.wp_signon()then runs ourwp_authenticate_usercheck, which never sawprocaptcha-response, so every AJAX login was rejected.action=user_registration_ajax_login_submitrequests.user_registration_after_login_failedresets the widget.Spectra: wrong token when a page has several forms
Spectra reads hidden fields with
getElementById('hidden'), which returns the first match on the whole page:a second Spectra form sent the first form's token;
a form whose own Spectra hidden field comes first sent no token.
Fix: our input no longer has that id. A hidden
<span id="prosopo_procaptcha">lets Spectra's per-form field loop send each form's own value.Testing
tools/check-code-quality.shpasses, including the 7 new unit tests.forms.min.js(2.20.5) in headless Chrome with two forms. With the old markup, form 2 senttok-1; with the new markup, each form sent its own token.ur-login.js(5.3.1) and clicked the AJAX login button. The request now includesprocaptcha-response, and a failed login resets the widget.Failed to fetcherrors from the browser to the Procaptcha provider. Reset the captcha after AJAX submissions, public JS events, log failed verifications (1.24.0) #67 had none of those errors. Beaver Builder wasn't changed here, so it looks environmental, but I'm checking it on this run.🤖 Generated with Claude Code