View Source PowEmailConfirmation.Plug (Pow v1.0.38)

Plug helper functions.

Summary

Functions

Confirms the e-mail for the user.

Check if the email for the current user is yet to be confirmed.

Verifies the signed token and fetches user.

Check if the there is a pending email change for the current user.

Signs the e-mail confirmation token for public consumption.

Functions

Link to this function

confirm_email(conn, params)

View Source
@spec confirm_email(Plug.Conn.t(), map()) ::
  {:ok, map(), Plug.Conn.t()} | {:error, map(), Plug.Conn.t()}

Confirms the e-mail for the user.

Expects user to exist in conn.assigns for key :confirm_email_user.

If successful, and a session exists, the session will be regenerated.

Link to this function

email_unconfirmed?(conn)

View Source
@spec email_unconfirmed?(Plug.Conn.t()) :: boolean()

Check if the email for the current user is yet to be confirmed.

Link to this function

load_user_by_token(conn, signed_token)

View Source
@spec load_user_by_token(Plug.Conn.t(), binary()) ::
  {:ok, Plug.Conn.t()} | {:error, Plug.Conn.t()}

Verifies the signed token and fetches user.

If a user is found, it'll be assigned to conn.assigns for key :confirm_email_user.

The token should have been signed with sign_confirmation_token/2. The token will be decoded and verified with Pow.Plug.verify_token/4.

Link to this function

pending_email_change?(conn)

View Source
@spec pending_email_change?(Plug.Conn.t()) :: boolean()

Check if the there is a pending email change for the current user.

Link to this function

sign_confirmation_token(conn, map)

View Source
@spec sign_confirmation_token(Plug.Conn.t(), map()) :: binary()

Signs the e-mail confirmation token for public consumption.

The token will be signed using Pow.Plug.sign_token/4.