From ee9d02e1b58eca823d76b6fe7d9458b089de3eba Mon Sep 17 00:00:00 2001
From: Andrew Duthie
Date: Fri, 19 Aug 2022 11:53:12 -0400
Subject: [PATCH] Remove validated_form_for form helper
**Why**: Because it's no longer needed as of #6771, since the purpose was to enhance forms with behaviors provided by the `form-validation.js` script, which was removed in #6771. The helper is now essentially an alias for simple_form_for, so we can call it directly instead.
changelog: Internal, Code Quality, Use common submit button handling
---
app/helpers/form_helper.rb | 6 ------
app/views/devise/passwords/edit.html.erb | 2 +-
app/views/devise/passwords/new.html.erb | 2 +-
app/views/devise/sessions/new.html.erb | 2 +-
app/views/event_disavowal/new.html.erb | 2 +-
app/views/forgot_password/show.html.erb | 6 +++---
app/views/idv/doc_auth/send_link.html.erb | 2 +-
app/views/idv/doc_auth/upload.html.erb | 4 ++--
app/views/idv/doc_auth/welcome.html.erb | 8 ++++----
app/views/idv/in_person/state_id.html.erb | 8 ++++----
app/views/idv/phone/new.html.erb | 2 +-
app/views/idv/shared/_document_capture.html.erb | 2 +-
app/views/mfa_confirmation/new.html.erb | 2 +-
app/views/password_capture/new.html.erb | 2 +-
app/views/shared/_email_languages.html.erb | 2 +-
app/views/sign_up/completions/show.html.erb | 2 +-
app/views/sign_up/email_resend/new.html.erb | 2 +-
app/views/sign_up/emails/show.html.erb | 6 +++---
app/views/sign_up/passwords/new.html.erb | 2 +-
.../backup_code_verification/show.html.erb | 2 +-
.../two_factor_authentication/options/index.html.erb | 2 +-
.../personal_key_verification/show.html.erb | 2 +-
app/views/users/edit_phone/edit.html.erb | 2 +-
app/views/users/email_language/show.html.erb | 2 +-
app/views/users/emails/show.html.erb | 2 +-
app/views/users/mfa_selection/index.html.erb | 8 ++++----
app/views/users/passwords/edit.html.erb | 2 +-
app/views/users/phone_setup/index.html.erb | 2 +-
app/views/users/phones/add.html.erb | 2 +-
.../users/two_factor_authentication_setup/index.html.erb | 8 ++++----
app/views/users/verify_password/new.html.erb | 2 +-
31 files changed, 47 insertions(+), 53 deletions(-)
diff --git a/app/helpers/form_helper.rb b/app/helpers/form_helper.rb
index af87acb3755..39d2f12754e 100644
--- a/app/helpers/form_helper.rb
+++ b/app/helpers/form_helper.rb
@@ -64,10 +64,4 @@ def us_states_territories
['Wyoming', 'WY'],
]
end
-
- private
-
- def validated_form_for(record, options = {}, &block)
- simple_form_for(record, options, &block)
- end
end
diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb
index 78e527b781c..abbc687ab36 100644
--- a/app/views/devise/passwords/edit.html.erb
+++ b/app/views/devise/passwords/edit.html.erb
@@ -4,7 +4,7 @@
<%= t('instructions.password.password_key') %>
-<%= validated_form_for(
+<%= simple_form_for(
@reset_password_form,
url: user_password_path,
html: { autocomplete: 'off',
diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb
index abfd9b30990..50a540f6f98 100644
--- a/app/views/devise/passwords/new.html.erb
+++ b/app/views/devise/passwords/new.html.erb
@@ -9,7 +9,7 @@
<%= t('instructions.password.forgot') %>
-<%= validated_form_for(
+<%= simple_form_for(
@password_reset_email_form,
url: user_password_path,
html: { autocomplete: 'off', method: :post },
diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb
index dc96b7ddecd..820be8f9529 100644
--- a/app/views/devise/sessions/new.html.erb
+++ b/app/views/devise/sessions/new.html.erb
@@ -13,7 +13,7 @@
<% end %>
<%= render 'shared/sp_alert' %>
-<%= validated_form_for(
+<%= simple_form_for(
resource,
as: resource_name,
url: session_path(resource_name),
diff --git a/app/views/event_disavowal/new.html.erb b/app/views/event_disavowal/new.html.erb
index 71ac97a4ffb..7c1456793ce 100644
--- a/app/views/event_disavowal/new.html.erb
+++ b/app/views/event_disavowal/new.html.erb
@@ -2,7 +2,7 @@
<%= render PageHeadingComponent.new.with_content(t('headings.passwords.change')) %>
-<%= validated_form_for(
+<%= simple_form_for(
@password_reset_from_disavowal_form,
url: events_disavowal_url,
html: { autocomplete: 'off',
diff --git a/app/views/forgot_password/show.html.erb b/app/views/forgot_password/show.html.erb
index 2897f91a9a6..2af37e556ee 100644
--- a/app/views/forgot_password/show.html.erb
+++ b/app/views/forgot_password/show.html.erb
@@ -16,9 +16,9 @@
<%= t('doc_auth.info.upload_from_computer') %>
- <%= validated_form_for(
+ <%= simple_form_for(
:doc_auth,
url: url_for(type: :desktop),
method: 'PUT',
diff --git a/app/views/idv/doc_auth/welcome.html.erb b/app/views/idv/doc_auth/welcome.html.erb
index 92a14fe1dc5..ea5b1d78c11 100644
--- a/app/views/idv/doc_auth/welcome.html.erb
+++ b/app/views/idv/doc_auth/welcome.html.erb
@@ -28,10 +28,10 @@
<% end %>
<% end %>
- <%= validated_form_for :doc_auth,
- url: url_for,
- method: 'put',
- html: { autocomplete: 'off', class: 'margin-y-5 js-consent-continue-form' } do |f| %>
+ <%= simple_form_for :doc_auth,
+ url: url_for,
+ method: 'put',
+ html: { autocomplete: 'off', class: 'margin-y-5 js-consent-continue-form' } do |f| %>
<%= f.submit t('doc_auth.buttons.continue') %>
<% end %>
diff --git a/app/views/idv/in_person/state_id.html.erb b/app/views/idv/in_person/state_id.html.erb
index 6995e0d873b..2defb0033b1 100644
--- a/app/views/idv/in_person/state_id.html.erb
+++ b/app/views/idv/in_person/state_id.html.erb
@@ -10,10 +10,10 @@
<%= t('in_person_proofing.body.state_id.info_html') %>
-<%= validated_form_for :doc_auth,
- url: url_for,
- method: 'put',
- html: { autocomplete: 'off', class: 'margin-y-5' } do |f| %>
+<%= simple_form_for :doc_auth,
+ url: url_for,
+ method: 'put',
+ html: { autocomplete: 'off', class: 'margin-y-5' } do |f| %>
<%= render ValidatedFieldComponent.new(
diff --git a/app/views/idv/phone/new.html.erb b/app/views/idv/phone/new.html.erb
index 59f6718d106..dfc825161b1 100644
--- a/app/views/idv/phone/new.html.erb
+++ b/app/views/idv/phone/new.html.erb
@@ -39,7 +39,7 @@
<%= t('idv.messages.phone.final_note_html') %>
-<%= validated_form_for(
+<%= simple_form_for(
@idv_form,
url: idv_phone_path,
data: {
diff --git a/app/views/idv/shared/_document_capture.html.erb b/app/views/idv/shared/_document_capture.html.erb
index 1bdb3657c0c..ec016b4a726 100644
--- a/app/views/idv/shared/_document_capture.html.erb
+++ b/app/views/idv/shared/_document_capture.html.erb
@@ -41,7 +41,7 @@
idv_in_person_url: Idv::InPersonConfig.enabled_for_issuer?(decorated_session.sp_issuer) ? idv_in_person_url : nil,
security_and_privacy_how_it_works_url: MarketingSite.security_and_privacy_how_it_works_url,
} %>
- <%= validated_form_for(
+ <%= simple_form_for(
:doc_auth,
url: url_for,
method: 'PUT',
diff --git a/app/views/mfa_confirmation/new.html.erb b/app/views/mfa_confirmation/new.html.erb
index 33d6966bdf0..a0aa93a3dba 100644
--- a/app/views/mfa_confirmation/new.html.erb
+++ b/app/views/mfa_confirmation/new.html.erb
@@ -8,7 +8,7 @@
t('help_text.change_factor', factor: user_session[:factor_to_change]) %>
-<%= validated_form_for(
+<%= simple_form_for(
current_user,
url: reauthn_user_password_path,
html: { autocomplete: 'off', method: 'post', class: 'margin-top-6' },
diff --git a/app/views/password_capture/new.html.erb b/app/views/password_capture/new.html.erb
index 92150653934..f7e6016a4b7 100644
--- a/app/views/password_capture/new.html.erb
+++ b/app/views/password_capture/new.html.erb
@@ -2,7 +2,7 @@
<%= render PageHeadingComponent.new.with_content(password_header) %>
-<%= validated_form_for(
+<%= simple_form_for(
current_user,
as: :user,
url: capture_password_url,
diff --git a/app/views/shared/_email_languages.html.erb b/app/views/shared/_email_languages.html.erb
index 8e75b731816..ed6262521dd 100644
--- a/app/views/shared/_email_languages.html.erb
+++ b/app/views/shared/_email_languages.html.erb
@@ -1,6 +1,6 @@
<%#
locals:
-* f: from validated_form_for
+* f: from simple_form_for
* selection: the current language selection
* hint: optional hint override
%>
diff --git a/app/views/sign_up/completions/show.html.erb b/app/views/sign_up/completions/show.html.erb
index f224e1d1035..ce7d5fbc550 100644
--- a/app/views/sign_up/completions/show.html.erb
+++ b/app/views/sign_up/completions/show.html.erb
@@ -34,7 +34,7 @@
<% end %>
<% end %>
- <%= validated_form_for(:idv_form, url: sign_up_completed_path) do |f| %>
+ <%= simple_form_for(:idv_form, url: sign_up_completed_path) do |f| %>
<%= f.submit t('sign_up.agree_and_continue') %>
<% end %>
diff --git a/app/views/sign_up/email_resend/new.html.erb b/app/views/sign_up/email_resend/new.html.erb
index a1cc9257566..645c72c5cde 100644
--- a/app/views/sign_up/email_resend/new.html.erb
+++ b/app/views/sign_up/email_resend/new.html.erb
@@ -1,7 +1,7 @@
<% title t('titles.confirmations.new') %>
<%= render PageHeadingComponent.new.with_content(t('headings.confirmations.new')) %>
-<%= validated_form_for(
+<%= simple_form_for(
@resend_email_confirmation_form,
url: sign_up_register_path,
html: { autocomplete: 'off', method: :post },
diff --git a/app/views/sign_up/emails/show.html.erb b/app/views/sign_up/emails/show.html.erb
index bea5f9e71c8..e9ac6282215 100644
--- a/app/views/sign_up/emails/show.html.erb
+++ b/app/views/sign_up/emails/show.html.erb
@@ -19,9 +19,9 @@
-<%= validated_form_for @resend_email_confirmation_form,
- html: { class: 'margin-bottom-2' },
- url: sign_up_register_path do |f| %>
+<%= simple_form_for @resend_email_confirmation_form,
+ html: { class: 'margin-bottom-2' },
+ url: sign_up_register_path do |f| %>
<%= f.input :email, as: :hidden %>
<%= f.input :resend, as: :hidden %>
<%= f.input :request_id, as: :hidden %>
diff --git a/app/views/sign_up/passwords/new.html.erb b/app/views/sign_up/passwords/new.html.erb
index ffc54e6dc05..3b11dedb889 100644
--- a/app/views/sign_up/passwords/new.html.erb
+++ b/app/views/sign_up/passwords/new.html.erb
@@ -5,7 +5,7 @@
<%= t('instructions.password.info.lead', min_length: Devise.password_length.first) %>
-<%= validated_form_for(
+<%= simple_form_for(
@password_form,
url: sign_up_create_password_path,
method: :post,
diff --git a/app/views/two_factor_authentication/backup_code_verification/show.html.erb b/app/views/two_factor_authentication/backup_code_verification/show.html.erb
index d365dc99c7e..e69f593ded8 100644
--- a/app/views/two_factor_authentication/backup_code_verification/show.html.erb
+++ b/app/views/two_factor_authentication/backup_code_verification/show.html.erb
@@ -6,7 +6,7 @@
<%= t('two_factor_authentication.backup_code_prompt') %>
-<%= validated_form_for(
+<%= simple_form_for(
@backup_code_form,
url: login_two_factor_backup_code_path,
html: { autocomplete: 'off', method: :post },
diff --git a/app/views/two_factor_authentication/options/index.html.erb b/app/views/two_factor_authentication/options/index.html.erb
index 957a2d1d5b7..918008a8ba1 100644
--- a/app/views/two_factor_authentication/options/index.html.erb
+++ b/app/views/two_factor_authentication/options/index.html.erb
@@ -8,7 +8,7 @@
<%= @presenter.info %>
-<%= validated_form_for(
+<%= simple_form_for(
@two_factor_options_form,
html: { autocomplete: 'off' },
method: :post,
diff --git a/app/views/two_factor_authentication/personal_key_verification/show.html.erb b/app/views/two_factor_authentication/personal_key_verification/show.html.erb
index dc615fdb4ad..6219ebae45d 100644
--- a/app/views/two_factor_authentication/personal_key_verification/show.html.erb
+++ b/app/views/two_factor_authentication/personal_key_verification/show.html.erb
@@ -6,7 +6,7 @@
<%= t('two_factor_authentication.personal_key_prompt') %>
-<%= validated_form_for(
+<%= simple_form_for(
@personal_key_form, url: login_two_factor_personal_key_path,
html: { autocomplete: 'off', method: :post }
) do |f| %>
diff --git a/app/views/users/edit_phone/edit.html.erb b/app/views/users/edit_phone/edit.html.erb
index c1c7ae48397..5ea8f5e099a 100644
--- a/app/views/users/edit_phone/edit.html.erb
+++ b/app/views/users/edit_phone/edit.html.erb
@@ -1,7 +1,7 @@
<% title t('titles.edit_info.phone') %>
<%= render PageHeadingComponent.new.with_content(t('headings.edit_info.phone')) %>
-<%= validated_form_for(
+<%= simple_form_for(
@edit_phone_form,
html: { autocomplete: 'off', method: :put },
url: manage_phone_path(id: @phone_configuration.id),
diff --git a/app/views/users/email_language/show.html.erb b/app/views/users/email_language/show.html.erb
index 0266dbc8c0e..db864d361b8 100644
--- a/app/views/users/email_language/show.html.erb
+++ b/app/views/users/email_language/show.html.erb
@@ -12,7 +12,7 @@
) %>
-<%= validated_form_for(current_user, url: account_email_language_path, method: 'PATCH') do |f| %>
+<%= simple_form_for(current_user, url: account_email_language_path, method: 'PATCH') do |f| %>
<%= render partial: 'shared/email_languages',
locals: { f: f, hint: false, selection: current_user.email_language } %>
<%= f.submit t('forms.buttons.submit.default'), class: 'grid-col-8 tablet:grid-col-6' %>
diff --git a/app/views/users/emails/show.html.erb b/app/views/users/emails/show.html.erb
index 61c4b1dca43..2702d88a964 100644
--- a/app/views/users/emails/show.html.erb
+++ b/app/views/users/emails/show.html.erb
@@ -5,7 +5,7 @@
<%= render PageHeadingComponent.new.with_content(t('headings.add_email')) %>
- <%= validated_form_for(
+ <%= simple_form_for(
@add_user_email_form,
html: { autocomplete: 'off' },
url: add_email_path,
diff --git a/app/views/users/mfa_selection/index.html.erb b/app/views/users/mfa_selection/index.html.erb
index 2449cc72490..a7a952c2496 100644
--- a/app/views/users/mfa_selection/index.html.erb
+++ b/app/views/users/mfa_selection/index.html.erb
@@ -4,10 +4,10 @@
<%= @presenter.intro %>
-<%= validated_form_for @two_factor_options_form,
- html: { autocomplete: 'off' },
- method: :patch,
- url: second_mfa_setup_path do |f| %>
+<%= simple_form_for @two_factor_options_form,
+ html: { autocomplete: 'off' },
+ method: :patch,
+ url: second_mfa_setup_path do |f| %>