From cdfea54d22f8757229013c7d2e0bba34dc78da83 Mon Sep 17 00:00:00 2001 From: Rebecca Le <543859+sevenseacat@users.noreply.github.com> Date: Fri, 15 Nov 2024 03:37:02 +0800 Subject: [PATCH] chore: Tweak UI styling (#530) * chore: Separate MagicLink form out to a new section on the bottom of the page * chore: Allow the submit label on the Password Reset form to be formatted a bit more nicely --- .../components/password/input.ex | 7 +++++++ lib/ash_authentication_phoenix/components/reset/form.ex | 1 - lib/ash_authentication_phoenix/components/sign_in.ex | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/ash_authentication_phoenix/components/password/input.ex b/lib/ash_authentication_phoenix/components/password/input.ex index b337021a..01d1b383 100644 --- a/lib/ash_authentication_phoenix/components/password/input.ex +++ b/lib/ash_authentication_phoenix/components/password/input.ex @@ -235,6 +235,13 @@ defmodule AshAuthentication.Phoenix.Components.Password.Input do |> assign_new(:overrides, fn -> [AshAuthentication.Phoenix.Overrides.Default] end) |> assign_new(:label, fn -> case assigns.action do + :reset -> + assigns.strategy.resettable + |> Kernel.||(%{}) + |> Map.get(:password_reset_action_name, :reset) + |> to_string() + |> String.trim_trailing("_with_password") + :request_reset -> assigns.strategy.resettable |> Kernel.||(%{}) diff --git a/lib/ash_authentication_phoenix/components/reset/form.ex b/lib/ash_authentication_phoenix/components/reset/form.ex index db1b5b9e..bbebd018 100644 --- a/lib/ash_authentication_phoenix/components/reset/form.ex +++ b/lib/ash_authentication_phoenix/components/reset/form.ex @@ -133,7 +133,6 @@ defmodule AshAuthentication.Phoenix.Components.Reset.Form do form={form} action={:reset} disable_text={override_for(@overrides, :disable_button_text)} - label={humanize(@resettable.password_reset_action_name)} overrides={@overrides} /> diff --git a/lib/ash_authentication_phoenix/components/sign_in.ex b/lib/ash_authentication_phoenix/components/sign_in.ex index 6f308bce..f0d977c7 100644 --- a/lib/ash_authentication_phoenix/components/sign_in.ex +++ b/lib/ash_authentication_phoenix/components/sign_in.ex @@ -178,7 +178,7 @@ defmodule AshAuthentication.Phoenix.Components.SignIn do defp strategy_style(%AshAuthentication.AddOn.Confirmation{}), do: nil defp strategy_style(%Strategy.Password{}), do: :form - defp strategy_style(%Strategy.MagicLink{}), do: :form + defp strategy_style(%Strategy.MagicLink{}), do: :link defp strategy_style(_), do: :link defp component_for_strategy(%{strategy_module: Strategy.Apple}), do: Components.Apple