more on authentication

This commit is contained in:
Helmut Merz 2025-06-14 17:14:52 +02:00
parent 94826533f0
commit e9e11843b8
3 changed files with 5 additions and 9 deletions

View file

@ -9,8 +9,8 @@ config :bcrypt_elixir, :log_rounds, 1
# to provide built-in test partitioning in CI environment. # to provide built-in test partitioning in CI environment.
# Run `mix help test` for more information. # Run `mix help test` for more information.
config :scopes, Scopes.Repo, config :scopes, Scopes.Repo,
username: "postgres", username: "testuser",
password: "postgres", password: "secret",
hostname: "localhost", hostname: "localhost",
database: "scopes_test#{System.get_env("MIX_TEST_PARTITION")}", database: "scopes_test#{System.get_env("MIX_TEST_PARTITION")}",
pool: Ecto.Adapters.SQL.Sandbox, pool: Ecto.Adapters.SQL.Sandbox,

View file

@ -3,9 +3,4 @@ defmodule ScopesWeb.DemoHTML do
embed_templates "demo_html/*" embed_templates "demo_html/*"
def index(assigns) do
~H"""
Hello World!
"""
end
end end

View file

@ -23,7 +23,6 @@ defmodule ScopesWeb.Router do
get "/", PageController, :home get "/", PageController, :home
get "/demo", DemoController, :index get "/demo", DemoController, :index
get "/demo/:messenger", DemoController, :show get "/demo/:messenger", DemoController, :show
live "/bingo/", Bingo
end end
# Other scopes may use custom stacks. # Other scopes may use custom stacks.
@ -41,7 +40,7 @@ defmodule ScopesWeb.Router do
import Phoenix.LiveDashboard.Router import Phoenix.LiveDashboard.Router
scope "/dev" do scope "/dev" do
pipe_through :browser pipe_through [:browser, :require_authenticated_user]
live_dashboard "/dashboard", metrics: ScopesWeb.Telemetry live_dashboard "/dashboard", metrics: ScopesWeb.Telemetry
forward "/mailbox", Plug.Swoosh.MailboxPreview forward "/mailbox", Plug.Swoosh.MailboxPreview
@ -68,9 +67,11 @@ defmodule ScopesWeb.Router do
pipe_through [:browser, :require_authenticated_user] pipe_through [:browser, :require_authenticated_user]
live_session :require_authenticated_user, live_session :require_authenticated_user,
root_layout: {ScopesWeb.Layouts, :root},
on_mount: [{ScopesWeb.UserAuth, :ensure_authenticated}] do on_mount: [{ScopesWeb.UserAuth, :ensure_authenticated}] do
live "/users/settings", UserSettingsLive, :edit live "/users/settings", UserSettingsLive, :edit
live "/users/settings/confirm_email/:token", UserSettingsLive, :confirm_email live "/users/settings/confirm_email/:token", UserSettingsLive, :confirm_email
live "/bingo", Bingo
end end
end end