AshAuthentication.Phoenix.Components.Otp.Input
(ash_authentication_phoenix v3.0.0-rc.6)
View Source
Function components for dealing with form input during OTP authentication.
Component hierarchy
These function components are consumed by
AshAuthentication.Phoenix.Components.Otp.RequestForm and
AshAuthentication.Phoenix.Components.Otp.VerifyForm.
Overrides
This component provides the following overrides:
:identity_input_label- Label for the identity field.:identity_input_placeholder- Placeholder for the identity field.:field_class- CSS class fordivelements surrounding the fields.:label_class- CSS class forlabelelements.:input_class- CSS class for text/codeinputelements.: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 for text/codeinputelements when there is a validation error.:input_debounce- Number of milliseconds to debounce input by (ornilto disable).:code_input_label- Label for the OTP code field.:code_input_placeholder- Placeholder for the OTP code field.:request_label- A function that takes the strategy and returns the request submit button text, or a string.:verify_label- A function that takes the strategy and returns the verify submit button text, or a string.
See AshAuthentication.Phoenix.Overrides for more information.
Summary
Functions
Generate a form field for the OTP code.
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(:overrides) => [module()], optional(:gettext_fn) => {module(), atom()} }) :: Phoenix.LiveView.Rendered.t() | no_return()
Generate a form field for the OTP code.
Props
socket- Phoenix LiveView socket. Required.strategy- The configuration map as perAshAuthentication.Info.strategy/2. Required.form- AnAshPhoenix.Form. 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. Required.strategy- The configuration map as perAshAuthentication.Info.strategy/2. Required.form- AnAshPhoenix.Form. Required.input_type- Either:textor:email. If not set, guessed from the identity field name.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 => :request | :verify, 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 configuration map as perAshAuthentication.Info.strategy/2. Required.form- AnAshPhoenix.Form. Required.action- Either:requestor:verify. Required.label- Optional override for the submit button label.disable_text- Text shown while the request is in flight.overrides- A list of override modules.gettext_fn- Optional text translation function.