Repository navigation
Clear expired tokens from JS-driven forms, send visitor IP to siteverify (1.23.0) - #65
Merged
Merged
Conversation
…siteverify - Wire expired-callback, error-callback and reset-callback to empty the custom token input and dispatch _prosopo-procaptcha__cleared, so Ninja Forms, WooCommerce block checkout and Beaver Builder stop submitting a token the server will reject. - Give each widget its own copy of the render options instead of mutating the shared procaptchaWpAttributes object, which the widget reuses on reset. - Chain user callbacks from the captcha_attributes filter rather than overwriting `callback`. - Send `ip` to /siteverify, with a prosopo/procaptcha/visitor_ip filter for sites behind a proxy. - Bump to 1.23.0. 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.
Brings the plugin in line with the current Procaptcha widget's callbacks and verify API.
Changes
callback. When a token expired, the widget removed its ownprocaptcha-responseinput, but the custom.prosopo-procaptcha-inputused by JS-driven forms kept the stale token. Client validation passed, then the server rejected the submission.expired-callback,error-callbackandreset-callbacknow empty that input and dispatch_prosopo-procaptcha__cleared.window.procaptchaWpAttributesobject and pass that same object to every widget. The widget stores the options and reuses them onreset(), so on a page with several widgets a reset would send the token to the last widget's form.callbackset throughprosopo/procaptcha/captcha_attributeswas overwritten; it is now called after the plugin's own. Function names work with or without awindow.prefix./siteverify. It comes fromREMOTE_ADDR. A newprosopo/procaptcha/visitor_ipfilter lets sites behind a proxy pass the real IP; anything that isn't a valid IP is dropped.Testing
tools/check-code-quality.shpasses: ESLint, Prettier, PHPStan, Pest and PHPCS.tscandyarn buildalso pass.Follow-up: the docs at https://docs.prosopo.io/en/wordpress-plugin/hooks/ give
$attributes['lang']as an example, but the option is calledlanguage. The docs should also cover the newvisitor_ipfilter.🤖 Generated with Claude Code