Skip to content

Remove old captcha nonce token JS#2547

Merged
Crabcyborg merged 2 commits into
masterfrom
remove_old_captcha_nonce_token_js
Oct 17, 2025
Merged

Remove old captcha nonce token JS#2547
Crabcyborg merged 2 commits into
masterfrom
remove_old_captcha_nonce_token_js

Conversation

@Crabcyborg
Copy link
Copy Markdown
Contributor

@Crabcyborg Crabcyborg commented Oct 17, 2025

This should have really been in Pro, and it's only required now if people are opting into the old nonce field which isn't likely.

But it looks like this all happens in PHP anyway. This JS isn't necessary, so we can just remove it.

This also helps move use away from jQuery.

🥳

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Oct 17, 2025

Walkthrough

Removed client-side post-submit logic that injected or updated a hidden recaptcha_checked input based on the AJAX response; the afterFormSubmitted callback flow remains unchanged. (Client-side reCAPTCHA state is no longer modified in this path.)

Changes

Cohort / File(s) Summary
reCAPTCHA post-submit state handling
js/formidable.js
Deleted the block that created/replaced a hidden recaptcha_checked input inside the form container after a successful AJAX submission; no other client-side recaptcha state updates added.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant Browser
participant Server
participant FormHandler
Note over Browser,FormHandler #DDDDFF: Previous flow (before change)
Browser->>FormHandler: Submit form (AJAX)
FormHandler->>Server: Send data
Server-->>FormHandler: response (includes response.recaptcha)
alt response.recaptcha present
FormHandler->>Browser: Insert/Update hidden recaptcha_checked input
end
FormHandler->>Browser: Trigger afterFormSubmitted


mermaid
sequenceDiagram
participant Browser
participant Server
participant FormHandler
Note over Browser,FormHandler #DDFFDD: New flow (after change)
Browser->>FormHandler: Submit form (AJAX)
FormHandler->>Server: Send data
Server-->>FormHandler: response (may include response.recaptcha)
FormHandler->>Browser: Trigger afterFormSubmitted
Note over FormHandler,Browser #FFEEEE: No client-side insertion/update of recaptcha_checked

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • garretlaxton
  • truongwp
  • engahmeds3ed

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title "Remove old captcha nonce token JS" directly and accurately reflects the main change in the changeset. The title is concise, clear, and specific—it identifies that legacy JavaScript related to captcha nonce tokens is being removed from js/formidable.js. The title is neither vague nor misleading, and it provides sufficient clarity for teammates reviewing the pull request history to understand the primary change at a glance.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed The pull request description is directly related to the changeset. The author explains that legacy JavaScript for captcha nonce token handling is being removed because the logic is already implemented in PHP, making the client-side code unnecessary. The description also mentions an additional benefit of moving away from jQuery. This rationale aligns well with the documented change of removing post-submit recaptcha handling from js/formidable.js. The description provides meaningful context about the removal rather than being vague or off-topic.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch remove_old_captcha_nonce_token_js

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@Crabcyborg Crabcyborg merged commit 667c791 into master Oct 17, 2025
16 checks passed
@Crabcyborg Crabcyborg deleted the remove_old_captcha_nonce_token_js branch October 17, 2025 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant