18F/identity-idp

View on GitHub
app/components/password_confirmation_component.html.erb

Summary

Maintainability
Test Coverage
<%= content_tag(:'lg-password-confirmation', **tag_options) do %>
  <%= render ValidatedFieldComponent.new(
        form: form,
        name: :password,
        type: :password,
        label: password_label,
        required: true,
        **field_options,
        input_html: field_options[:input_html].to_h.merge(
          id: input_id,
          autocomplete: 'new-password',
          class: ['password-confirmation__input', *field_options.dig(:input_html, :class)],
        ),
      ) %>
  <%= render ValidatedFieldComponent.new(
        form: form,
        name: :password_confirmation,
        type: :password_confirmation,
        label: confirmation_label,
        required: true,
        **field_options,
        input_html: field_options[:input_html].to_h.merge(
          id: input_confirmation_id,
          autocomplete: 'new-password',
          class: ['password-confirmation__input-confirmation', *field_options.dig(:input_html, :class)],
        ),
        wrapper_html: field_options[:wrapper_html].to_h.merge(
          class: ['margin-bottom-0', *field_options.dig(:wrapper_html, :class)],
        ),
        error_messages: {
          valueMissing: t('components.password_confirmation.errors.empty'),
        },
      ) %>
  <input
    id="<%= toggle_id %>"
    type="checkbox"
    class="usa-checkbox__input password-confirmation__toggle"
    aria-controls="<%= input_id %> <%= input_confirmation_id %>"
  >
  <label
    for="<%= toggle_id %>"
    class="usa-checkbox__label password-confirmation__toggle-label"
  >
    <%= t('components.password_confirmation.toggle_label') %>
  </label>
  <%= render PasswordStrengthComponent.new(input_id:, forbidden_passwords:) %>
<% end %>