Password Validator v0.1.1 PasswordValidator.Validators.LengthValidator View Source
Validates a password by checking the length of the password.
Link to this section Summary
Functions
Validate the
Link to this section Functions
Validate the
Example config (min 5 characters, max 9 characters) [ length: [
min: 5,
max: 9,
] ]
Examples
iex> LengthValidator.validate("simple2", [length: [min: 3]])
:ok
iex> LengthValidator.validate("too_short", [length: [min: 10]])
{:error, ["String is too short. Got 9 needed 10"]}
iex> LengthValidator.validate("too_long", [length: [min: 3, max: 6]])
{:error, ["String is too long. Got 8 needed 6"]}