Pow v0.1.0-alpha.5 Pow.Plug.Base behaviour View Source
This plug macro will set :pow_config
as private, and attempt to fetch and
assign a user in the connection if it has not already been assigned. The user
will be assigned automatically in any of the operations.
Example
defmodule MyAppWeb.Pow.CustomPlug do
use Pow.Plug.Base
def fetch(conn, _config) do
user = fetch_user_from_cookie(conn)
{conn, user}
end
def create(conn, user, _config) do
conn = update_cookie(conn, user)
{conn, user}
end
def delete(conn, _config) do
delete_cookie(conn)
end
end
Link to this section Summary
Link to this section Callbacks
Link to this callback
call(arg0, arg1)
View Source
call(Plug.Conn.t(), Pow.Config.t()) :: Plug.Conn.t()
Link to this callback
create(arg0, map, arg2)
View Source
create(Plug.Conn.t(), map(), Pow.Config.t()) :: {Plug.Conn.t(), map()}
Link to this callback
delete(arg0, arg1)
View Source
delete(Plug.Conn.t(), Pow.Config.t()) :: Plug.Conn.t()
Link to this callback
fetch(arg0, arg1)
View Source
fetch(Plug.Conn.t(), Pow.Config.t()) :: {Plug.Conn.t(), map() | nil}