mirror of
https://github.com/team-alembic/ash_authentication_phoenix.git
synced 2024-09-20 05:23:55 +12:00
fix: Overrides in reset route (#250)
* Pass overrides to the banner in Reset component * Match reset_route macro live_options with sign_in macro
This commit is contained in:
parent
2cf59a7bd4
commit
2640f97823
2 changed files with 20 additions and 11 deletions
|
@ -64,7 +64,7 @@ defmodule AshAuthentication.Phoenix.Components.Reset do
|
||||||
~H"""
|
~H"""
|
||||||
<div class={override_for(@overrides, :root_class)}>
|
<div class={override_for(@overrides, :root_class)}>
|
||||||
<%= if override_for(@overrides, :show_banner, true) do %>
|
<%= if override_for(@overrides, :show_banner, true) do %>
|
||||||
<.live_component module={Components.Banner} id="sign-in-banner" />
|
<.live_component module={Components.Banner} id="sign-in-banner" overrides={@overrides} />
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= for strategy <- @strategies do %>
|
<%= for strategy <- @strategies do %>
|
||||||
|
|
|
@ -230,7 +230,9 @@ defmodule AshAuthentication.Phoenix.Router do
|
||||||
{path, opts} = Keyword.pop(opts, :path, "/password-reset")
|
{path, opts} = Keyword.pop(opts, :path, "/password-reset")
|
||||||
{live_view, opts} = Keyword.pop(opts, :live_view, AshAuthentication.Phoenix.ResetLive)
|
{live_view, opts} = Keyword.pop(opts, :live_view, AshAuthentication.Phoenix.ResetLive)
|
||||||
{as, opts} = Keyword.pop(opts, :as, :auth)
|
{as, opts} = Keyword.pop(opts, :as, :auth)
|
||||||
{on_mount, opts} = Keyword.pop(opts, :on_mount, [])
|
{otp_app, opts} = Keyword.pop(opts, :otp_app)
|
||||||
|
{layout, opts} = Keyword.pop(opts, :layout)
|
||||||
|
{on_mount, opts} = Keyword.pop(opts, :on_mount)
|
||||||
|
|
||||||
{overrides, opts} =
|
{overrides, opts} =
|
||||||
Keyword.pop(opts, :overrides, [AshAuthentication.Phoenix.Overrides.Default])
|
Keyword.pop(opts, :overrides, [AshAuthentication.Phoenix.Overrides.Default])
|
||||||
|
@ -239,19 +241,26 @@ defmodule AshAuthentication.Phoenix.Router do
|
||||||
opts
|
opts
|
||||||
|> Keyword.put_new(:alias, false)
|
|> Keyword.put_new(:alias, false)
|
||||||
|
|
||||||
live_session_opts = [
|
|
||||||
on_mount: [AshAuthenticationPhoenix.Router.OnLiveViewMount | on_mount]
|
|
||||||
]
|
|
||||||
|
|
||||||
quote do
|
quote do
|
||||||
scope unquote(path), unquote(opts) do
|
scope unquote(path), unquote(opts) do
|
||||||
import Phoenix.LiveView.Router, only: [live: 4, live_session: 3]
|
import Phoenix.LiveView.Router, only: [live: 4, live_session: 3]
|
||||||
|
|
||||||
live_session :reset, unquote(live_session_opts) do
|
live_session_opts = [
|
||||||
live("/:token", unquote(live_view), :reset,
|
session: %{"overrides" => unquote(overrides), "otp_app" => unquote(otp_app)},
|
||||||
as: unquote(as),
|
on_mount: [AshAuthenticationPhoenix.Router.OnLiveViewMount | unquote(on_mount || [])]
|
||||||
private: %{overrides: unquote(overrides)}
|
]
|
||||||
)
|
|
||||||
|
live_session_opts =
|
||||||
|
case unquote(layout) do
|
||||||
|
nil ->
|
||||||
|
live_session_opts
|
||||||
|
|
||||||
|
layout ->
|
||||||
|
Keyword.put(live_session_opts, :layout, layout)
|
||||||
|
end
|
||||||
|
|
||||||
|
live_session :reset, live_session_opts do
|
||||||
|
live("/:token", unquote(live_view), :reset, as: unquote(as))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue