The meter under a new-password field: four bars that fill as the password meets the rules, a line saying how
strong it is, and the rules with a mark for each that is met. The server computes it from the text
(evaluate/2) and the field sends it on phx-change; nothing is kept in the browser.
The rules are three: at least min_length characters, both capitals and small letters, and a number or a
symbol. A password meeting all three and at least four characters longer than the minimum is score 4; with the
field empty it is 0. The words for the rules and the line are the caller's; the marks are slots.
Summary
Functions
What a password meets: %{score: 0..4, rules: [length: boolean, mixed_case: boolean, digit_or_symbol: boolean]}.
Functions
@spec evaluate(String.t(), pos_integer()) :: %{score: 0..4, rules: keyword(boolean())}
What a password meets: %{score: 0..4, rules: [length: boolean, mixed_case: boolean, digit_or_symbol: boolean]}.
Attributes
score(:integer) (required) - 0 to 4, fromevaluate/2.label(:string) (required) - the line under the bars, e.g.Strong.rules(:list) (required) -%{label: text, met: boolean}each.class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
met_icon- the mark of a rule that is met.unmet_icon- the mark of a rule that is not met yet.