AshAuthentication.Phoenix.TotpSetupLive (ash_authentication_phoenix v3.0.0-rc.6)

View Source

A generic, white-label TOTP setup page for configuring two-factor authentication.

This live-view is used by authenticated users to set up TOTP on their account. It displays a QR code that can be scanned with an authenticator app, and a code input field to confirm the setup.

Usage

Add to your router using the totp_setup_route/3 macro:

scope "/", MyAppWeb do
  pipe_through [:browser, :require_authenticated_user]
  totp_setup_route MyApp.Accounts.User, :totp, auth_routes_prefix: "/auth"
end

Note: This route should be protected by authentication middleware to ensure only authenticated users can access it.

Overrides

This component provides the following overrides:

  • :root_class - CSS class for the root div element.
  • :error_class - CSS class for the error message when user is not authenticated.
  • :totp_setup_id - Element ID for the TotpSetup LiveComponent.

See AshAuthentication.Phoenix.Overrides for more information.