Password v1.1.1 Password.Policy.Length View Source
Checks whether input is of certain minimum length.
By default, the minimum length is 8 characters, although we recommend increasing it higher.
By design, you cannot set a maximum length — passwords should be hashed, so the maximum length shouldn’t matter in technical terms.
use Password, [
{Password.Policy.Length}
]
iex> MyApp.Password.validate("pass")
{:error, [Password.Policy.Length]}
iex> MyApp.Password.validate("password")
:ok
Increasing minimum length:
use Password, [
{Password.Policy.Length, min: 10}
]
iex> MyApp.Password.validate("password")
{:error, [Password.Policy.Length]}