fix: Re-link form labels and form inputs on Password strategy forms (#494)

* fix: Restore linkage between form inputs and form fields on Password strategy form

This will allow clicking the label to focus the field

* fix: Use separate override labels for Password and Password Confirmation fields
This commit is contained in:
Rebecca Le 2024-08-13 22:13:39 +08:00 committed by GitHub
parent df1e7c7b03
commit 7960763bfc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 4 deletions

View file

@ -3,8 +3,9 @@ defmodule AshAuthentication.Phoenix.Components.Password.Input do
field_class: "CSS class for `div` elements surrounding the fields.",
label_class: "CSS class for `label` elements.",
input_class: "CSS class for text/password `input` elements.",
identity_input_label: "Label for identity (email) field.",
identity_input_label: "Label 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.",
@ -86,7 +87,7 @@ defmodule AshAuthentication.Phoenix.Components.Password.Input do
~H"""
<div class={override_for(@overrides, :field_class)}>
<%= label(@form, override_for(@overrides, :identity_input_label),
<%= label(@form, @identity_field, override_for(@overrides, :identity_input_label),
class: override_for(@overrides, :label_class)
) %>
<%= text_input(@form, @identity_field,
@ -138,7 +139,7 @@ defmodule AshAuthentication.Phoenix.Components.Password.Input do
~H"""
<div class={override_for(@overrides, :field_class)}>
<%= label(@form, override_for(@overrides, :password_input_label),
<%= label(@form, @password_field, override_for(@overrides, :password_input_label),
class: override_for(@overrides, :label_class)
) %>
<%= password_input(@form, @password_field,
@ -189,7 +190,10 @@ defmodule AshAuthentication.Phoenix.Components.Password.Input do
~H"""
<div class={override_for(@overrides, :field_class)}>
<%= label(@form, override_for(@overrides, :password_input_label),
<%= label(
@form,
@password_confirmation_field,
override_for(@overrides, :password_confirmation_input_label),
class: override_for(@overrides, :label_class)
) %>
<%= password_input(@form, @password_confirmation_field,

View file

@ -143,6 +143,7 @@ defmodule AshAuthentication.Phoenix.Overrides.Default do
"""
set :password_input_label, "Password"
set :password_confirmation_input_label, "Password Confirmation"
set :identity_input_label, "Email"
set :error_ul, "text-red-400 font-light my-3 italic text-sm"
set :error_li, nil