View Source AshAuthentication.Strategy.Password.PasswordConfirmationValidation (ash_authentication v4.3.7)
Validate that the password and password confirmation match.
This check is only performed when the confirmation_required?
DSL option is
set to true
.
You can use this validation in your own actions where you want to validate that the password and the password confirmation arguments match. If you're not using one of the actions generated by the password strategy then you'll need to manually pass the strategy name in the changeset context. Eg:
Changeset.new(user, %{})
|> Changeset.set_context(%{strategy_name: :password})
|> Changeset.for_update(:change_password, params)
|> Accounts.update()
or by adding it statically in your action definition:
update :change_password do
change set_context(%{strategy_name: :password})
change AshAuthentication.Strategy.Password.HashPasswordChange
end
Summary
Functions
Validates that the password and password confirmation fields contain equivalent values - if confirmation is required.
Functions
@spec validate(Ash.Changeset.t(), keyword(), Ash.Resource.Validation.Context.t()) :: :ok | {:error, String.t() | Exception.t()}
Validates that the password and password confirmation fields contain equivalent values - if confirmation is required.