Pow.Phoenix.Controller (Pow v1.0.24) View Source

Used with Pow Phoenix controllers to handle messages, routes and callbacks.

Usage

defmodule MyPowExtension.Phoenix.MyController do
  use Pow.Phoenix.Controller

  def process_new(conn, _params) do
    {:ok, :response, conn}
  end

  def respond_new({:ok, :response, conn}) do
    render(conn, "new.html")
  end
end

Configuration options

Link to this section Summary

Functions

Handles the controller action call.

Fetches messages backend from configuration, or use fallback.

Ensures that the page can't be cached in browser.

Ensures that user has been authenticated.

Ensures that user hasn't been authenticated.

Fetches routes backend from configuration, or use fallback.

Link to this section Functions

Link to this function

action(controller, conn, params)

View Source

Specs

action(atom(), Plug.Conn.t(), map()) :: Plug.Conn.t()

Handles the controller action call.

If a :controller_callbacks module has been set in the configuration, then before_process and before_respond will be called on this module on all actions.

Link to this function

messages(conn, fallback)

View Source

Specs

messages(Plug.Conn.t(), atom()) :: atom()

Fetches messages backend from configuration, or use fallback.

Link to this function

put_no_cache_header(conn, opts)

View Source

Specs

put_no_cache_header(Plug.Conn.t(), Keyword.t()) :: Plug.Conn.t()

Ensures that the page can't be cached in browser.

This will add a "cache-control" header with "no-cache, no-store, must-revalidate" if the cache control header hasn't been changed from the default value in the Plug.Conn struct.

Link to this function

require_authenticated(conn, opts)

View Source

Specs

require_authenticated(Plug.Conn.t(), Keyword.t()) :: Plug.Conn.t()

Ensures that user has been authenticated.

Pow.Phoenix.PlugErrorHandler is used as error handler. See Pow.Plug.RequireAuthenticated for more.

Link to this function

require_not_authenticated(conn, opts)

View Source

Specs

require_not_authenticated(Plug.Conn.t(), Keyword.t()) :: Plug.Conn.t()

Ensures that user hasn't been authenticated.

Pow.Phoenix.PlugErrorHandler is used as error handler. See Pow.Plug.RequireNotAuthenticated for more.

Specs

route_helper(atom()) :: binary()

Specs

routes(Plug.Conn.t(), atom()) :: atom()

Fetches routes backend from configuration, or use fallback.