diff --git a/lib/mix/tasks/ash_authentication.add_strategy.ex b/lib/mix/tasks/ash_authentication.add_strategy.ex index cbf3689b..27d89b1b 100644 --- a/lib/mix/tasks/ash_authentication.add_strategy.ex +++ b/lib/mix/tasks/ash_authentication.add_strategy.ex @@ -164,22 +164,6 @@ if Code.ensure_loaded?(Igniter) do run AshAuthentication.Strategy.MagicLink.Request end """) - |> Ash.Resource.Igniter.add_new_action(options[:user], :change_password, """ - update :change_password do - # Use this action to allow users to change their password by providing - # their current password and a new password. - - accept [] - argument :current_password, :string, sensitive?: true, allow_nil?: false - argument :password, :string, sensitive?: true, allow_nil?: false - argument :password_confirmation, :string, sensitive?: true, allow_nil?: false - - validate confirm(:password, :password_confirmation) - validate {AshAuthentication.Strategy.Password.PasswordValidation, strategy_name: :password, password_argument: :current_password} - - change {AshAuthentication.Strategy.Password.HashPasswordChange, strategy_name: :password} - end - """) |> AshAuthentication.Igniter.add_new_strategy(options[:user], :magic_link, :magic_link, """ magic_link do identity_field :#{options[:identity_field]} @@ -221,6 +205,22 @@ if Code.ensure_loaded?(Igniter) do end end """) + |> Ash.Resource.Igniter.add_new_action(options[:user], :change_password, """ + update :change_password do + # Use this action to allow users to change their password by providing + # their current password and a new password. + + accept [] + argument :current_password, :string, sensitive?: true, allow_nil?: false + argument :password, :string, sensitive?: true, allow_nil?: false + argument :password_confirmation, :string, sensitive?: true, allow_nil?: false + + validate confirm(:password, :password_confirmation) + validate {AshAuthentication.Strategy.Password.PasswordValidation, strategy_name: :password, password_argument: :current_password} + + change {AshAuthentication.Strategy.Password.HashPasswordChange, strategy_name: :password} + end + """) |> generate_sign_in_and_registration(options) |> generate_reset(sender, options) |> add_confirmation(options)