Skip to content

Change-password form: surface validation (strength, mismatch, inline, client-side) - #106

Merged
WebTigers merged 1 commit into
mainfrom
fix/password-form-validation
Aug 7, 2026
Merged

Change-password form: surface validation (strength, mismatch, inline, client-side)#106
WebTigers merged 1 commit into
mainfrom
fix/password-form-validation

Conversation

@WebTigers

Copy link
Copy Markdown
Owner

Follow-up to #105 (CSRF token). The profile Security / change-password form flagged fields with a red icon but no explanation, and the strength meter never showed. Three real gaps, from the reported screenshot:

1. Field errors weren't localized → messages showed as raw keys (or not at all)

Tiger_Validate_Password sets its message to a semantic key (password.too_short); _formErrors shipped that raw key to the client, and the view only added .is-invalid (red icon) without rendering any message. Now:

  • Tiger_Service_Service::_formErrors translates each field message the same courtesy messages[] already get via Tiger_Model_MessageObject (non-key prose passes through unchanged).
  • Adds the password.* policy strings + core.form.password_mismatch to core/languages/en/core.php.
  • The view renders each field's localized message inline in an .invalid-feedback.

2. Mismatch said "The two given tokens do not match"

The confirm field's Identical validator now carries a custom message key → "Passwords do not match."

3. Strength meter never appeared on this page

tiger.password-strength.js was loaded only by the auth layout, so data-tiger-strength was inert on the account-layout profile page. It's now loaded in the Security partial (the meter auto-attaches).

Plus: client-side match, no wasted round trip

The view checks new === confirm before posting (shows "Passwords do not match." inline and returns), and clears a field's error on input.

Verified on dev-com

  • weak, matching → new_password: "Password is too short — please use at least 8 characters."
  • strong, mismatch → confirm_password: "Passwords do not match."
  • strength JS present on /user/profile.

🤖 Generated with Claude Code

… client-side)

The profile Security form flagged fields with a red icon but no explanation, and the
password strength meter never appeared. Three real gaps:

- Field errors weren't localized. A validator can set its message to a semantic key
  (Tiger_Validate_Password → password.too_short); _formErrors shipped that raw key to
  the client. Now _formErrors translates each field message the same way messages[]
  already are (non-key prose passes through). Adds the password.* policy strings +
  core.form.password_mismatch to core lang.
- The confirm field returned Zend's default "The two given tokens do not match".
  Give the Identical validator a custom message key → "Passwords do not match."
- The strength meter (tiger.password-strength.js) was only loaded by the auth layout,
  so data-tiger-strength did nothing on the account-layout profile page. Load it in
  the Security partial.

The view now renders each field's (localized) message inline in an .invalid-feedback,
clears it on input, and does a client-side new/confirm match check before the round trip.

Verified on dev-com: weak → "Password is too short…", mismatch → "Passwords do not match."

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@WebTigers
WebTigers merged commit d6945e9 into main Aug 7, 2026
12 checks passed
@WebTigers
WebTigers deleted the fix/password-form-validation branch August 7, 2026 17:10
WebTigers added a commit that referenced this pull request Aug 7, 2026
…on UX (#107)

Bug-fix release: the single-use CSRF token (#105) and the change-password form's
validation surfacing — localized inline field errors, the strength meter on the
profile page, a clear 'Passwords do not match', and a client-side match check (#106).
Also backfills the 0.51.0-beta CHANGELOG entry that was skipped.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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