t741: fix(checkout): add form_has_auto_generate_password() and strip JS password rules#742
Conversation
…sword rules Add protected form_has_auto_generate_password() method to the Checkout class that iterates form settings to detect password fields with auto_generate_password enabled. Use this method in get_js_validation_rules() to unset the password, password_conf, and valid_password rules when auto-generate is active, preventing the JS validator from blocking submission on a field that is never rendered. Closes #741
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis change refactors password validation detection in the checkout class by extracting inline logic into a dedicated protected helper method. The helper Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
🔨 Build Complete - Ready for Testing!📦 Download Build Artifact (Recommended)Download the zip build, upload to WordPress and test:
🌐 Test in WordPress Playground (Very Experimental)Click the link below to instantly test this PR in your browser - no installation needed! Login credentials: |
|
Performance Test Results Performance test results for 1b68f44 are in 🛎️! Note: the numbers in parentheses show the difference to the previous (baseline) test run. Differences below 2% or 0.5 in absolute values are not shown. URL:
|
…password - Signup_Field_Password_Test: 6 new tests covering auto_generate_password defaults, get_fields toggle, to_fields_array hidden flag emission, v-show guards on strength meter and confirm field - Checkout_Form_Test: 11 new tests covering simple template validation, use_template() structure, field presence, auto-generate flags on username/password/site_title/site_url, filterable hook, and save path All 17 tests pass against the implementation already in main (PRs #737, #739, #742). Closes #746
…erated credentials (#747) * chore: add t524 simple checkout form feature to backlog (re-implement PR #740) * test(checkout): add unit tests for simple template and auto-generate password - Signup_Field_Password_Test: 6 new tests covering auto_generate_password defaults, get_fields toggle, to_fields_array hidden flag emission, v-show guards on strength meter and confirm field - Checkout_Form_Test: 11 new tests covering simple template validation, use_template() structure, field presence, auto-generate flags on username/password/site_title/site_url, filterable hook, and save path All 17 tests pass against the implementation already in main (PRs #737, #739, #742). Closes #746
Summary
form_has_auto_generate_password(): boolprotected method to theCheckoutclass that iterates form settings to detect password fields withauto_generate_passwordenabledget_js_validation_rules()tounset()thepassword,password_conf, andvalid_passwordrules when auto-generate is activeProblem
After PR #737 (simple checkout form template) merged, checkout forms using auto-generated passwords had their JS validator require a password field that was never shown, blocking form submission.
Acceptance Criteria
form_has_auto_generate_password()method exists inCheckoutclassget_js_validation_rules()strips password rules when auto-generate is enabledCloses #741
aidevops.sh v3.5.718 plugin for OpenCode v1.3.0 with claude-sonnet-4-6 spent 2m and 5,470 tokens on this as a headless worker.
Summary by CodeRabbit