AshAuthentication.Phoenix.Components.Totp.SetupForm
(ash_authentication_phoenix v3.0.0-rc.6)
View Source
Generates a setup form for TOTP authentication with QR code display.
This component handles the complete TOTP setup flow:
- Shows a "Set up" button
- When clicked, calls the setup action to generate a secret
- Displays the QR code and code input field
- Validates the code (format only for confirmation mode)
- Confirms setup when user submits valid code
Requirements
This component requires the eqrcode library for QR code generation.
Add it to your dependencies:
{:eqrcode, "~> 0.1"}Component hierarchy
This is a child of AshAuthentication.Phoenix.Components.Totp.
Children:
AshAuthentication.Phoenix.Components.Totp.Input.code_field/1AshAuthentication.Phoenix.Components.Totp.Input.submit/1
Props
strategy- The configuration map as perAshAuthentication.Info.strategy/2. Required.label- The text to show in the submit label. Generated from the configured action name (viaPhoenix.Naming.humanize/1) if not supplied. Set tofalseto disable.overrides- A list of override modules.gettext_fn- Optional text translation function.
Overrides
This component provides the following overrides:
:root_class- CSS class for the rootdivelement.:slot_class- CSS class for thedivsurrounding the slot.:form_class- CSS class for theformelement.:button_text- Text for the submit button.:disable_button_text- Text for the submit button when the request is happening.:label_class- CSS class for theh2element.:instructions_class- CSS class for setup instructions text.:instructions_text- Instructions text shown above QR code.:error_class- CSS class for error messages.:qr_code_class- CSS class for the QR code container.:qr_code_wrapper_class- CSS class for the wrapper around QR code and instructions.:setup_button_text- Text for the initial setup button.:setup_button_class- CSS class for the initial setup button.
See AshAuthentication.Phoenix.Overrides for more information.
Summary
Types
@type props() :: %{ :strategy => AshAuthentication.Strategy.t(), optional(:label) => String.t() | false, optional(:current_tenant) => String.t(), optional(:context) => map(), optional(:auth_routes_prefix) => String.t(), optional(:overrides) => [module()], optional(:gettext_fn) => {module(), atom()} }