Pow v1.0.21 PowInvitation.Plug View Source
Plug helper methods.
Link to this section Summary
Functions
Creates a changeset from the user fetched in the connection.
Creates a new invited user by the current user in the connection.
Verifies the signed token and fetches invited user.
Signs the invitation token for public consumption.
Updates current user in the connection with the params.
Link to this section Functions
change_user(conn, params \\ %{})
View Sourcechange_user(Plug.Conn.t(), map()) :: map()
Creates a changeset from the user fetched in the connection.
create_user(conn, params)
View Sourcecreate_user(Plug.Conn.t(), map()) :: {:ok, map(), Plug.Conn.t()} | {:error, map(), Plug.Conn.t()}
Creates a new invited user by the current user in the connection.
load_invited_user_by_token(conn, signed_token)
View Sourceload_invited_user_by_token(Plug.Conn.t(), binary()) :: {:ok, Plug.Conn.t()} | {:error, Plug.Conn.t()}
Verifies the signed token and fetches invited user.
If a user is found, it'll be assigned to conn.assigns
for key
:invited_user
.
The token should have been signed with sign_invitation_token/2
. The token
will be decoded and verified with Pow.Plug.verify_token/4
.
sign_invitation_token(conn, map)
View Sourcesign_invitation_token(Plug.Conn.t(), map()) :: binary()
Signs the invitation token for public consumption.
The token will be signed using Pow.Plug.sign_token/4
.
update_user(conn, params)
View Sourceupdate_user(Plug.Conn.t(), map()) :: {:ok, map(), Plug.Conn.t()} | {:error, map(), Plug.Conn.t()}
Updates current user in the connection with the params.
Expects the invited user to exist in conn.assigns
for key
:invited_user
.
If successful the session will be regenerated.