View Source AshAuthentication.Phoenix.Components.Password.Input (ash_authentication_phoenix v2.4.4)

Function components for dealing with form input during password authentication.

Component hierarchy

These function components are consumed by AshAuthentication.Phoenix.Components.Password.SignInForm, AshAuthentication.Phoenix.Components.Password.RegisterForm and AshAuthentication.Phoenix.Components.ResetForm.

Overrides

This component provides the following overrides:

  • :label_class - CSS class for label elements.
  • :field_class - CSS class for div elements surrounding the fields.
  • :input_class - CSS class for text/password input elements.
  • :identity_input_label - Label for identity field.
  • :identity_input_placeholder - Placeholder for identity field.
  • :password_input_label - Label for password field.
  • :password_confirmation_input_label - Label for password confirmation field.
  • :input_class_with_error - CSS class for text/password input elements when there is a validation error.
  • :submit_class - CSS class for the form submit input element.
  • :error_ul - CSS class for the ul element on error lists.
  • :error_li - CSS class for the li elements on error lists.
  • :input_debounce - Number of milliseconds to debounce input by (or nil to disable).

See AshAuthentication.Phoenix.Overrides for more information.

Summary

Functions

Generate a list of errors for a field (if there are any).

Generate a form field for the configured identity field.

Generate a form field for the configured password confirmation entry field.

Generate a form field for the configured password entry field.

Generate an form submit button.

Functions

error(assigns)

@spec error(%{
  :socket => Phoenix.LiveView.Socket.t(),
  :form => AshPhoenix.Form.t(),
  :field => atom(),
  optional(:field_label) => String.Chars.t(),
  optional(:errors) => [{atom(), String.t()}]
}) :: Phoenix.LiveView.Rendered.t() | no_return()

Generate a list of errors for a field (if there are any).

Props

  • socket - Phoenix LiveView socket. This is needed to be able to retrieve the correct CSS configuration. Required.
  • form - An AshPhoenix.Form. Required.
  • field - The field for which to retrieve the errors. Required.
  • overrides - A list of override modules.

identity_field(assigns)

@spec identity_field(%{
  :socket => Phoenix.LiveView.Socket.t(),
  :strategy => AshAuthentication.Strategy.t(),
  :form => AshPhoenix.Form.t(),
  optional(:input_type) => :text | :email,
  optional(:overrides) => [module()]
}) :: 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 per AshAuthentication.authenticated_resources/1. Required.
  • form - An AshPhoenix.Form. Required.
  • input_type - Either :text or :email. If not set it will try and guess based on the name of the identity field.
  • overrides - A list of override modules.

password_confirmation_field(assigns)

@spec password_confirmation_field(%{
  :socket => Phoenix.LiveView.Socket.t(),
  :strategy => AshAuthentication.Strategy.t(),
  :form => AshPhoenix.Form.t(),
  optional(:overrides) => [module()]
}) :: Phoenix.LiveView.Rendered.t() | no_return()

Generate a form field for the configured password confirmation entry field.

Props

password_field(assigns)

@spec password_field(%{
  :socket => Phoenix.LiveView.Socket.t(),
  :strategy => AshAuthentication.Strategy.t(),
  :form => AshPhoenix.Form.t(),
  optional(:overrides) => [module()]
}) :: Phoenix.LiveView.Rendered.t() | no_return()

Generate a form field for the configured password entry field.

Props

submit(assigns)

@spec submit(%{
  :socket => Phoenix.LiveView.Socket.t(),
  :strategy => AshAuthentication.Strategy.t(),
  :form => AshPhoenix.Form.t(),
  :action => :sign_in | :register,
  optional(:label) => String.t(),
  optional(:overrides) => [module()]
}) :: Phoenix.LiveView.Rendered.t() | no_return()

Generate an form submit button.

Props

  • socket - Phoenix LiveView socket. This is needed to be able to retrieve the correct CSS configuration. Required.
  • strategy - The configuration map as per AshAuthentication.authenticated_resources/1. Required.
  • form - An AshPhoenix.Form. Required.
  • action - Either :sign_in or :register. Required.
  • label - The text to show in the submit label. Generated from the configured action name (via Phoenix.Naming.humanize/1) if not supplied.
  • overrides - A list of override modules.