View Source AshAuthentication.AddOn.Confirmation.ConfirmationHookChange (ash_authentication v4.3.7)

Triggers a confirmation flow when one of the monitored fields is changed.

Optionally inhibits changes to monitored fields on update.

You can use this change in your actions where you want to send the user a confirmation (or inhibit changes after confirmation). If you're not using one of the actions generated by the confirmation add-on then you'll need to manually pass the strategy name in the changeset context. Eg:

Changeset.new(user, %{})
|> Changeset.set_context(%{strategy_name: :confirm})
|> Changeset.for_update(:update, params)
|> Accounts.update()

or by adding it statically to your action definition:

update :change_email do
  change set_context(%{strategy_name: :confirm})
  change AshAuthentication.AddOn.Confirmation.ConfirmationHookChange
end

or by adding it as an option to the change definition:

update :change_email do
  change {AshAuthentication.AddOn.Confirmation.ConfirmationHookChange, strategy_name: :confirm}
end