2022-10-25 11:23:05 +13:00
|
|
|
defmodule DevWeb.Router do
|
|
|
|
@moduledoc false
|
|
|
|
|
|
|
|
use DevWeb, :router
|
2022-12-08 14:32:26 +13:00
|
|
|
use AshAuthentication.Phoenix.Router, otp_app: :ash_authentication_phoenix
|
2022-10-25 11:23:05 +13:00
|
|
|
|
|
|
|
pipeline :browser do
|
|
|
|
plug :accepts, ["html"]
|
|
|
|
plug :fetch_session
|
|
|
|
plug :fetch_live_flash
|
|
|
|
plug :put_root_layout, {DevWeb.LayoutView, :root}
|
|
|
|
plug :protect_from_forgery
|
|
|
|
plug :put_secure_browser_headers
|
2022-10-25 17:02:56 +13:00
|
|
|
plug :load_from_session
|
2022-10-25 11:23:05 +13:00
|
|
|
end
|
|
|
|
|
|
|
|
pipeline :api do
|
|
|
|
plug :accepts, ["json"]
|
|
|
|
end
|
|
|
|
|
|
|
|
scope "/", DevWeb do
|
|
|
|
pipe_through(:browser)
|
|
|
|
|
2023-01-12 15:54:23 +13:00
|
|
|
ash_authentication_live_session do
|
|
|
|
live "/", HomePageLive
|
2023-03-23 15:05:42 +13:00
|
|
|
live "/custom-sign-in", CustomSignInLive
|
2023-01-12 15:54:23 +13:00
|
|
|
end
|
2022-10-25 11:23:05 +13:00
|
|
|
end
|
|
|
|
|
2022-10-25 17:02:56 +13:00
|
|
|
scope "/", DevWeb do
|
|
|
|
pipe_through :browser
|
2022-12-08 14:32:26 +13:00
|
|
|
auth_routes_for(Example.Accounts.User, to: AuthController, path: "/auth")
|
2022-12-15 14:52:11 +13:00
|
|
|
sign_in_route(overrides: [DevWeb.AuthOverrides, AshAuthentication.Phoenix.Overrides.Default])
|
2022-10-25 17:02:56 +13:00
|
|
|
sign_out_route(AuthController, "/sign-out")
|
2022-12-15 16:31:52 +13:00
|
|
|
reset_route()
|
2022-10-25 17:02:56 +13:00
|
|
|
end
|
2022-10-25 11:23:05 +13:00
|
|
|
end
|