fix: handle change from ash_authentication where resettable is no lon… (#279)

This commit is contained in:
Zach Daniel 2023-09-22 12:13:16 -04:00 committed by GitHub
parent 62bd241e4e
commit 693a41f95e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 14 deletions

View file

@ -1,2 +1,2 @@
erlang 25.2
elixir 1.14.2
erlang 26.0.2
elixir 1.15.4

View file

@ -107,14 +107,15 @@ defmodule AshAuthentication.Phoenix.Components.Password do
strategy.registration_enabled? && override_for(assigns.overrides, :register_toggle_text)
reset_enabled? =
Enum.any?(strategy.resettable) && override_for(assigns.overrides, :reset_toggle_text)
strategy.resettable && override_for(assigns.overrides, :reset_toggle_text)
reset_id =
strategy.resettable
|> Enum.map(
&generate_id(subject_name, strategy_name, &1.request_password_reset_action_name)
)
|> List.first()
strategy.resettable &&
generate_id(
subject_name,
strategy_name,
strategy.resettable.request_password_reset_action_name
)
assigns =
assigns

View file

@ -225,8 +225,8 @@ defmodule AshAuthentication.Phoenix.Components.Password.Input do
case assigns.action do
:request_reset ->
assigns.strategy.resettable
|> Enum.map(& &1.request_password_reset_action_name)
|> List.first(:request_reset)
|> Kernel.||(%{})
|> Map.get(:request_password_reset_action_name, :reset_request)
|> to_string()
|> String.trim_trailing("_with_password")
@ -248,7 +248,10 @@ defmodule AshAuthentication.Phoenix.Components.Password.Input do
|> assign_new(:disable_text, fn -> nil end)
~H"""
<%= submit(@label, class: override_for(@overrides, :submit_class), phx_disable_with: @disable_text) %>
<%= submit(@label,
class: override_for(@overrides, :submit_class),
phx_disable_with: @disable_text
) %>
"""
end

View file

@ -162,7 +162,7 @@ defmodule AshAuthentication.Phoenix.Components.Password.ResetForm do
Map.get(params, param_key, %{})
end
defp blank_form(%{resettable: [resettable]} = strategy) do
defp blank_form(%{resettable: resettable} = strategy) when not is_nil(resettable) do
api = Info.authentication_api!(strategy.resource)
subject_name = Info.authentication_subject_name!(strategy.resource)

View file

@ -58,11 +58,11 @@ defmodule AshAuthentication.Phoenix.Components.Reset.Form do
api = Info.authentication_api!(strategy.resource)
subject_name = Info.authentication_subject_name!(strategy.resource)
[resettable] = strategy.resettable
resettable = strategy.resettable
form =
strategy.resource
|> Form.for_action(resettable.password_reset_action_name,
|> Form.for_action(strategy.resettable.password_reset_action_name,
api: api,
as: subject_name |> to_string(),
id: