View Source PowEmailConfirmation.Phoenix.ControllerCallbacks (Pow v1.0.36)

Controller callback logic for e-mail confirmation.

User hasn't confirmed e-mail

Triggers on Pow.Phoenix.RegistrationController.create/2 and Pow.Phoenix.SessionController.create/2.

When a user is created or authenticated, and the current e-mail hasn't been confirmed, a confirmation e-mail is sent, the session will be cleared, an error flash is set for the conn and the user redirected back to Pow.Phoenix.Routes.after_registration_path/1 or Pow.Phoenix.Routes.after_sign_in_path/1 respectively.

User updates e-mail

Triggers on Pow.Phoenix.RegistrationController.update/2 and PowInvitation.Phoenix.InvitationController.update/2

When a user changes their e-mail, a confirmation e-mail is send to the new e-mail, and an error flash is set for the conn. The same happens if the PowInvitation extension is enabled, and a user updates their e-mail when accepting their invitation. It's assumed that the current e-mail for the invited user has already been confirmed, see PowInvitation.Ecto.Schema.invite_changeset/3 for more.

See PowEmailConfirmation.Ecto.Schema for more.

Unique constraint error on :email

Triggers on Pow.Phoenix.RegistrationController.create/2.

When a user can't be created and the changeset has a unique constraint error for the :email field, the user will experience the same success flow as if the user could be created, but no e-mail is sent out. This prevents user enumeration. If pow_prevent_user_enumeration: false is set in conn.private the form with error will be shown instead.

Summary

Functions

Link to this function

send_confirmation_email(user, conn)

View Source
@spec send_confirmation_email(map(), Plug.Conn.t()) :: any()

Sends a confirmation e-mail to the user.

The user struct passed to the mailer will have the :email set to the :unconfirmed_email value if :unconfirmed_email is set.