AshAuthentication.Phoenix.Components.Totp.Input
(ash_authentication_phoenix v3.0.0-rc.6)
View Source
Function components for dealing with form input during TOTP authentication.
Component hierarchy
These function components are consumed by
AshAuthentication.Phoenix.Components.Totp.SignInForm and
AshAuthentication.Phoenix.Components.Totp.SetupForm.
Overrides
This component provides the following overrides:
:identity_input_label- Label for identity field.:identity_input_placeholder- Placeholder for identity field.:field_class- CSS class fordivelements surrounding the fields.:label_class- CSS class forlabelelements.:input_class- CSS class forinputelements.:submit_class- CSS class for the form submitinputelement.:error_ul- CSS class for theulelement on error lists.:error_li- CSS class for thelielements on error lists.:input_class_with_error- CSS class forinputelements when there is a validation error.:input_debounce- Number of milliseconds to debounce input by (ornilto disable).:code_input_label- Label for TOTP code field.:code_input_placeholder- Placeholder for TOTP code field.:valid_code_class- CSS class applied to code field when validation passes.:invalid_code_class- CSS class applied to code field when validation fails.
See AshAuthentication.Phoenix.Overrides for more information.
Summary
Functions
Generate a form field for the TOTP code.
Generate a list of errors for a field (if there are any).
Generate a form field for the configured identity field.
Generate a form submit button.
Functions
@spec code_field(%{ :socket => Phoenix.LiveView.Socket.t(), :strategy => AshAuthentication.Strategy.t(), :form => AshPhoenix.Form.t(), optional(:code_valid) => boolean() | nil, optional(:overrides) => [module()], optional(:gettext_fn) => {module(), atom()} }) :: Phoenix.LiveView.Rendered.t() | no_return()
Generate a form field for the TOTP code.
Props
socket- Phoenix LiveView socket. Required.strategy- The strategy configuration. Required.form- AnAshPhoenix.Form. Required.code_valid- Boolean indicating if the code is currently valid (for setup forms).overrides- A list of override modules.gettext_fn- Optional text translation function.
@spec error(%{ :socket => Phoenix.LiveView.Socket.t(), :form => AshPhoenix.Form.t(), :field => atom(), optional(:field_label) => String.Chars.t(), optional(:errors) => [{atom(), String.t()}], optional(:gettext_fn) => {module(), atom()} }) :: Phoenix.LiveView.Rendered.t() | no_return()
Generate a list of errors for a field (if there are any).
Props
socket- Phoenix LiveView socket. Required.form- AnAshPhoenix.Form. Required.field- The field for which to retrieve the errors. Required.overrides- A list of override modules.gettext_fn- Optional text translation function.
@spec identity_field(%{ :socket => Phoenix.LiveView.Socket.t(), :strategy => AshAuthentication.Strategy.t(), :form => AshPhoenix.Form.t(), optional(:input_type) => :text | :email, optional(:overrides) => [module()], optional(:gettext_fn) => {module(), atom()} }) :: Phoenix.LiveView.Rendered.t() | no_return()
Generate a form field for the configured identity field.
Props
socket- Phoenix LiveView socket. This is needed to be able to retrieve the correct CSS configuration. Required.strategy- The configuration map as perAshAuthentication.authenticated_resources/1. Required.form- AnAshPhoenix.Form. Required.input_type- Either:textor:email. If not set it will try and guess based on the name of the identity field.overrides- A list of override modules.gettext_fn- Optional text translation function.
@spec submit(%{ :socket => Phoenix.LiveView.Socket.t(), :strategy => AshAuthentication.Strategy.t(), :form => AshPhoenix.Form.t(), :action => :sign_in | :setup | :confirm_setup, optional(:label) => String.t(), optional(:disable_text) => String.t(), optional(:overrides) => [module()], optional(:gettext_fn) => {module(), atom()} }) :: Phoenix.LiveView.Rendered.t() | no_return()
Generate a form submit button.
Props
socket- Phoenix LiveView socket. Required.strategy- The strategy configuration. Required.form- AnAshPhoenix.Form. Required.action- Either:sign_in,:setup, or:confirm_setup. Required.label- The text to show in the submit label.disable_text- Text to show when the button is disabled.overrides- A list of override modules.gettext_fn- Optional text translation function.