PasswordStrength Plugin
Evaluates password strength on a 0–4 scale and validates against a minimum score threshold.
Score Algorithm
| Score | Criteria met |
|---|---|
| 0 | None (empty or very short) |
| 1 | Length ≥ 8 |
| 2 | + Uppercase letter |
| 3 | + Digit |
| 4 | + Special character |
Each criterion adds 1 point. A password with all four criteria scores 4.
Options
| Option | Type | Default | Description |
|---|---|---|---|
field | string | (required) | The field name to evaluate |
message | string | 'The password is not strong enough' | Error message when score is below minScore |
minScore | number | 3 | Minimum required score (0–4) |
onScore | function | undefined | Called after each evaluation: ({ field, score, valid }) => void |
Playground
Type a password and click Validate to see the strength score. The indicator below the field updates in real time via the onScore callback.
Notes
- Adds a strength validator to the specified
fieldat plugin install time — the field must already exist infields. - Score is computed each time the field is validated (not on every keystroke unless
Triggeris configured). - Use
onScorewith theTriggerplugin (event: 'input') for live feedback as the user types. - Two
PasswordStrengthinstances on different fields are fully independent. - Removing the plugin (via
deregisterPlugin) removes the strength validator from the field.