<secure-password-confirm>
Two linked password fields - a "New Password" and a "Confirm Password" - in a single component. Match validation fires only after the confirm field is first blurred. The raw password is never exposed in custom events. Security tier is locked to CRITICAL.
Overview
<secure-password-confirm> renders two linked password fields in a single custom element. It handles match validation, strength enforcement, and show/hide toggling internally. The raw password value is never included in custom events — retrieve it with getPasswordValue() at submission time only.
The security tier is locked to CRITICAL and cannot be overridden.
<script type="module"
src="/components/secure-password-confirm/secure-password-confirm.js">
</script><secure-password-confirm
name="password"
required>
</secure-password-confirm>Security Model
Security tier is immutably fixed to CRITICAL. The following guarantees are always enforced:
- Raw password value never dispatched in events — call
getPasswordValue()only at submission - Hidden input populated only when both fields match; cleared immediately on mismatch
- Hidden input omitted entirely when nested inside
<secure-form> - Match and mismatch events audited at CRITICAL tier via the base class logger
| Control | Detail |
|---|---|
| Raw value isolation | The password value is never dispatched in events. Call getPasswordValue() to retrieve it programmatically. |
| Tier lock | Security tier is hard-coded to CRITICAL. The security-tier attribute has no effect. |
| Audit logging | Match and mismatch events are recorded via the base class audit logger at CRITICAL tier. |
| Hidden input | A hidden <input type="hidden"> is created outside the Shadow DOM. Populated only when both fields match. Omitted when inside <secure-form>. |
Match Validation Behaviour
Match validation is intentionally deferred to avoid showing errors on every keystroke. The validation lifecycle is:
| Event | Behaviour |
|---|---|
| Confirm field first blur | Validation runs. secure-password-match or secure-password-mismatch is dispatched. Error message is shown. |
| Subsequent input (either field) | Validation re-runs on each keystroke after the confirm field has been blurred at least once. |
| Match achieved | Error message clears. Hidden input is populated. secure-password-match fires. |
| Mismatch | Error message reads "Passwords do not match". Hidden input is cleared. secure-password-mismatch fires. |
Strength Rules
Strength is evaluated on the new-password field. The valid getter returns false when strength requirements are not met. All five requirements must be satisfied:
| Rule | Requirement |
|---|---|
| Minimum length | At least 8 characters |
| Uppercase | At least one uppercase letter (A–Z) |
| Lowercase | At least one lowercase letter (a–z) |
| Digit | At least one numeric digit (0–9) |
| Special character | At least one of: ! @ # $ % ^ & * ( ) _ + - = [ ] { } ; ' : " , . < > ? |
Strength indicators are rendered below the new-password field as five inline markers. Each marker turns green when its rule is satisfied.
API Reference
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
name | string | — | Name of the hidden form input. Omitted when inside <secure-form>. |
label | string | — | Optional section label rendered above both fields. |
password-label | string | New Password | Label text above the new-password field. |
confirm-label | string | Confirm Password | Label text above the confirm-password field. |
required | boolean | false | Marks both fields as required. |
disabled | boolean | false | Disables both fields and the show/hide toggles. |
Properties
name attribute.Methods
null otherwise. This is the only way to retrieve the raw value — it is intentionally absent from all events.Events
| Event | Detail | When |
|---|---|---|
secure-password-match | { name, matched: true } | After confirm field blur when both fields match. |
secure-password-mismatch | { name, matched: false } | After confirm field blur when fields do not match. |
secure-password-confirm-change | { name, tier } | Fired on each keystroke in either field. Raw value intentionally absent. |