Skip to content

Commit

Permalink
chore: fix tests around non-required email setup
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed Dec 12, 2024
1 parent 87965f3 commit 9e82aaa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lib/mix/tasks/ash_authentication.add_strategy.ex
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ defmodule Mix.Tasks.AshAuthentication.AddStrategy do
monitor_fields [:email]
confirm_on_create? true
confirm_on_update? false
auto_confirm_actions [:sign_in_with_magic_link]
auto_confirm_actions [:sign_in_with_magic_link, :reset_password_with_password]
sender #{inspect(sender)}
end
"""
Expand Down Expand Up @@ -523,7 +523,9 @@ defmodule Mix.Tasks.AshAuthentication.AddStrategy do
|> Ash.Resource.Igniter.add_new_action(options[:user], :register_with_password, """
create :register_with_password do
description "Register a new user with a #{options[:identity_field]} and password."
argument :#{options[:identity_field]}, :string, allow_nil?: false
argument :#{options[:identity_field]}, :ci_string do
allow_nil? false
end
argument :password, :string do
description "The proposed password for the user, in plain text."
Expand Down
8 changes: 7 additions & 1 deletion test/mix/tasks/ash_authentication.add_strategy_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,10 @@ defmodule Mix.Tasks.AshAuthentication.AddStrategyTest do
+ |
+ | create :register_with_password do
+ | description("Register a new user with a email and password.")
+ | accept([:email])
+ |
+ | argument :email, :ci_string do
+ | allow_nil?(false)
+ | end
+ |
+ | argument :password, :string do
+ | description("The proposed password for the user, in plain text.")
Expand All @@ -132,6 +135,9 @@ defmodule Mix.Tasks.AshAuthentication.AddStrategyTest do
+ | sensitive?(true)
+ | end
+ |
+ | # Sets the email from the argument
+ | change(set_attribute(:email, arg(:email)))
+ |
+ | # Hashes the provided password
+ | change(AshAuthentication.Strategy.Password.HashPasswordChange)
+ |
Expand Down

0 comments on commit 9e82aaa

Please sign in to comment.