View Source Pow.Phoenix.Routes behaviour (Pow v1.0.36)

Module that handles routes.

Usage

defmodule MyAppWeb.Pow.Routes do
  use Pow.Phoenix.Routes
  use MyAppWeb, :verified_routes

  @impl true
  def after_sign_out_path(conn), do: ~p"/some-path"
end

Update configuration with routes_backend: MyAppWeb.Pow.Routes.

You can also customize path generation:

defmodule MyAppWeb.Pow.Routes do
  use Pow.Phoenix.Routes
  use MyAppWeb, :verified_routes

  @impl true
  def url_for(conn, verb, vars \ [], query_params \ [])
  def url_for(conn, PowEmailConfirmation.Phoenix.ConfirmationController, :show, [token], _query_params),
    do: ~p"/custom-confirmation/#{token}"
  def url_for(conn, plug, verb, vars, query_params),
    do: Pow.Phoenix.Routes.url_for(conn, plug, verb, vars, query_params)
end

Summary

Functions

Path to redirect user to when user has signed up.

Path to redirect user to when user has signed in.

Path to redirect user to when user has signed out.

Path to redirect user to when user has deleted their account.

Path to redirect user to when user has updated their account.

Path to redirect user to when user has already been authenticated.

Path to redirect user to when user is not authenticated.

Callbacks

Link to this callback

after_registration_path(t)

View Source
@callback after_registration_path(Plug.Conn.t()) :: binary()
@callback after_sign_in_path(Plug.Conn.t()) :: binary()
@callback after_sign_out_path(Plug.Conn.t()) :: binary()
Link to this callback

after_user_deleted_path(t)

View Source
@callback after_user_deleted_path(Plug.Conn.t()) :: binary()
Link to this callback

after_user_updated_path(t)

View Source
@callback after_user_updated_path(Plug.Conn.t()) :: binary()
Link to this callback

path_for(t, atom, atom, list, t)

View Source
@callback path_for(Plug.Conn.t(), atom(), atom(), list(), Keyword.t()) :: binary()
Link to this callback

registration_path(t, atom)

View Source
@callback registration_path(Plug.Conn.t(), atom()) :: binary()
Link to this callback

session_path(t, atom, list)

View Source
@callback session_path(Plug.Conn.t(), atom(), list()) :: binary()
Link to this callback

url_for(t, atom, atom, list, t)

View Source
@callback url_for(Plug.Conn.t(), atom(), atom(), list(), Keyword.t()) :: binary()
Link to this callback

user_already_authenticated_path(t)

View Source
@callback user_already_authenticated_path(Plug.Conn.t()) :: binary()
Link to this callback

user_not_authenticated_path(t)

View Source
@callback user_not_authenticated_path(Plug.Conn.t()) :: binary()

Functions

Link to this function

after_registration_path(conn, routes_module \\ __MODULE__)

View Source

Path to redirect user to when user has signed up.

By default this is the same as after_sign_in_path/1.

Link to this function

after_sign_in_path(params, routes_module \\ __MODULE__)

View Source

Path to redirect user to when user has signed in.

This will look for a :request_path assigns key, and redirect to this value if it exists.

Link to this function

after_sign_out_path(conn, routes_module \\ __MODULE__)

View Source

Path to redirect user to when user has signed out.

Link to this function

after_user_deleted_path(conn, routes_module \\ __MODULE__)

View Source

Path to redirect user to when user has deleted their account.

By default this is the same as after_sign_out_path/1.

Link to this function

after_user_updated_path(conn, routes_module \\ __MODULE__)

View Source

Path to redirect user to when user has updated their account.

Link to this function

path_for(conn, plug, verb, vars \\ [], query_params \\ [])

View Source
@spec path_for(Plug.Conn.t(), atom(), atom(), list(), Keyword.t()) :: binary()

Generates a path route.

Link to this function

url_for(conn, plug, verb, vars \\ [], query_params \\ [])

View Source
@spec url_for(Plug.Conn.t(), atom(), atom(), list(), Keyword.t()) :: binary()

Generates a url route.

Link to this function

user_already_authenticated_path(conn, routes_module \\ __MODULE__)

View Source

Path to redirect user to when user has already been authenticated.

By default this is the same as after_sign_in_path/1.

Link to this function

user_not_authenticated_path(conn, routes_module \\ __MODULE__)

View Source

Path to redirect user to when user is not authenticated.

This will put a :request_path param into the path that can be used to redirect users back the the page they first attempted to visit. See after_sign_in_path/1 for how :request_path is handled.

The :request_path will only be added if the request uses "GET" method.

See Pow.Phoenix.SessionController for more on how this value is handled.