Skip to content

Commit

Permalink
improvement: store all tokens by default in generators
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed Dec 13, 2024
1 parent 9cce641 commit a3c21c0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
5 changes: 5 additions & 0 deletions lib/mix/tasks/ash_authentication.install.ex
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,11 @@ defmodule Mix.Tasks.AshAuthentication.Install do
[:authentication, :tokens, :signing_secret],
secrets_module
)
|> Spark.Igniter.set_option(
user_resource,
[:authentication, :tokens, :store_all_tokens?],
true
)
|> Igniter.Project.Config.configure_new(
"dev.exs",
otp_app,
Expand Down
18 changes: 9 additions & 9 deletions test/mix/tasks/ash_authentication.add_strategy_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ defmodule Mix.Tasks.AshAuthentication.AddStrategyTest do
igniter
|> Igniter.compose_task("ash_authentication.add_strategy", ["password"])
|> assert_has_patch("lib/test/accounts/user.ex", """
26 + | strategies do
27 + | password :password do
28 + | identity_field(:email)
29 + |
30 + | resettable do
31 + | sender(Test.Accounts.User.Senders.SendPasswordResetEmail)
32 + | end
33 + | end
34 + | end
+ | strategies do
+ | password :password do
+ | identity_field(:email)
+ |
+ | resettable do
+ | sender(Test.Accounts.User.Senders.SendPasswordResetEmail)
+ | end
+ | end
+ | end
""")
end

Expand Down
1 change: 1 addition & 0 deletions test/mix/tasks/ash_authentication.install_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ defmodule Mix.Tasks.AshAuthentication.InstallTest do
enabled?(true)
token_resource(Test.Accounts.Token)
signing_secret(Test.Secrets)
store_all_tokens?(true)
end
end
Expand Down

0 comments on commit a3c21c0

Please sign in to comment.