Pow v1.0.13 PowResetPassword.Plug View Source

Plug helper methods.

Link to this section Summary

Functions

Assigns a :reset_password_user key with the user in the connection.

Creates a changeset from the user fetched in the connection.

Finds a user for the provided params, creates a token, and stores the user for the token.

Updates the password for the user fetched in the connection.

Fetches user from the store by the provided token.

Link to this section Functions

Link to this function

assign_reset_password_user(conn, user) View Source
assign_reset_password_user(Plug.Conn.t(), map()) :: Plug.Conn.t()

Assigns a :reset_password_user key with the user in the connection.

Link to this function

change_user(conn, params \\ %{}) View Source
change_user(Plug.Conn.t(), map()) :: map()

Creates a changeset from the user fetched in the connection.

Link to this function

create_reset_token(conn, params) View Source
create_reset_token(Plug.Conn.t(), map()) ::
  {:ok, map(), Plug.Conn.t()} | {:error, map(), Plug.Conn.t()}

Finds a user for the provided params, creates a token, and stores the user for the token.

To prevent timing attacks, Pow.UUID.generate/0 is called whether the user exists or not.

:reset_password_token_store can be passed in the config for the conn. This value defaults to {PowResetPassword.Store.ResetTokenCache, backend: Pow.Store.Backend.EtsCache}. The Pow.Store.Backend.EtsCache backend store can be changed with the :cache_store_backend option.

Link to this function

update_user_password(conn, params) View Source
update_user_password(Plug.Conn.t(), map()) ::
  {:ok, map(), Plug.Conn.t()} | {:error, map(), Plug.Conn.t()}

Updates the password for the user fetched in the connection.

See create_reset_token/2 for more on :reset_password_token_store config option.

Link to this function

user_from_token(conn, token) View Source
user_from_token(Plug.Conn.t(), binary()) :: map() | nil

Fetches user from the store by the provided token.

See create_reset_token/2 for more on :reset_password_token_store config option.