[#10] Added reveal toggle and confirmation mode to the password widget.#25
Merged
Conversation
📝 WalkthroughWalkthroughPassword fields now support opt-in reveal cycling and confirmation entry. Configuration flows from builders through ChangesPassword widget enhancements
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant PasswordWidget
participant PasswordDisplay
User->>PasswordWidget: Press Tab
PasswordWidget->>PasswordDisplay: Cycle display mode
PasswordDisplay-->>PasswordWidget: Return next mode
PasswordWidget-->>User: Render hidden, masked, or plaintext input
User->>PasswordWidget: Submit first password
PasswordWidget-->>User: Prompt for confirmation
User->>PasswordWidget: Submit second password
PasswordWidget->>PasswordWidget: Compare and validate entries
PasswordWidget-->>User: Complete or show an error
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
This comment has been minimized.
This comment has been minimized.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #25 +/- ##
==========================================
+ Coverage 98.88% 98.92% +0.03%
==========================================
Files 56 57 +1
Lines 1349 1395 +46
==========================================
+ Hits 1334 1380 +46
Misses 15 15 ☔ View full report in Codecov by Harness. |
|
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.
Closes #10
Summary
Adds two opt-in enhancements to
PasswordWidget, both off by default so the existing masked-only behaviour is unchanged unless a consumer asks for them: a reveal toggle that cycles the live editor display between hidden, masked and plaintext, and a confirmation mode that prompts for the value twice and rejects a mismatch before accepting. Both flags are threaded throughField,FieldBuilderandWidgetFactoryand exposed as fluentrevealable()/confirm()builder methods. The panel row and summary always stay masked regardless of the live editor display.Changes
PasswordDisplayenum (Hidden/Masked/Plaintext) with anext()method that cycles Hidden → Masked → Plaintext → Hidden.PasswordWidgetgainedrevealableandconfirmconstructor flags: Tab cyclesPasswordDisplaywhen revealable, and Enter drives a two-step confirm flow (stash first entry, clear the buffer, compare on the second Enter, restart with an error on mismatch, revalidate the matched value before accepting).PasswordWidget::view()now renders extra footer lines for the confirm re-prompt, the reveal hint (enter accept · tab reveal · esc cancel) and any error, and a newrenderLine()helper renders the buffer according to the currentPasswordDisplay.PasswordWidget::rendersHint(), returningtrueonly whenrevealableis enabled.Fieldgainedrevealableandconfirmbool properties (defaultFALSE).FieldBuildergained fluentrevealable()andconfirm()methods, wired intobuild().WidgetFactorypasses$field->revealableand$field->confirmthrough when constructing aPasswordWidget.revealable()->confirm()example.widget-password-revealplayground demo and generateddocs/assets/widget-password-reveal.svg(viadocs/util/update-assets.php), shown under the README Password grid so the reveal toggle and itstab revealhint are visible.PasswordDisplayTestfor the display cycle, extendedPasswordWidgetTestwith reveal-toggle, hint-visibility and confirm-flow coverage, and extendedFormTestandWidgetFactoryTestfor the builder and factory wiring.Before / After