PhoenixKitWeb.Users.ConfirmationInstructions (phoenix_kit v1.7.221)

Copy Markdown View Source

LiveView for resending email confirmation instructions.

Allows users to request a new confirmation email if they didn't receive the original or if the link expired. Only sends if the account exists and is not already confirmed.

This page is also where the authentication gates park logged-in users whose email is not yet confirmed (when require_email_confirmation is on), so it moves them along as soon as confirmation happens:

  • On mount, an already-confirmed user is redirected onward immediately — covers a confirmation done elsewhere (or directly in the DB) followed by a refresh, since the user is reloaded from the DB on every mount.
  • While parked, the LiveView listens on this user's own confirmation topic for {:user_confirmed, user} (broadcast by both the email-link flow and the admin confirm action) and redirects onward live, no refresh needed — e.g. when the user clicks the emailed link in another tab. It is a per-user topic, not the site-wide admin users feed, so a parked non-admin never receives other users' structs.

"Onward" is ?return_to= (stashed by the gate that parked them), then the session's user_return_to, then the after_login_path setting.

Summary

Functions

handle_event(binary, map, socket)

Callback implementation for Phoenix.LiveView.handle_event/3.

handle_info(arg1, socket)

Callback implementation for Phoenix.LiveView.handle_info/2.

mount(params, session, socket)

Callback implementation for Phoenix.LiveView.mount/3.

render(assigns)

Callback implementation for Phoenix.LiveView.render/1.