From eed4eef39a92464459496a476e5e3cccfbe084ab Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 9 Jan 2024 11:03:16 -0500 Subject: [PATCH] Fix `LineLength` haml-lint in `app/views/auth` area (#28664) --- .haml-lint_todo.yml | 6 +-- app/views/auth/challenges/new.html.haml | 6 ++- app/views/auth/confirmations/new.html.haml | 8 ++- app/views/auth/passwords/edit.html.haml | 13 ++++- app/views/auth/passwords/new.html.haml | 7 ++- .../registrations/_account_warning.html.haml | 4 +- .../auth/registrations/_session.html.haml | 4 +- app/views/auth/registrations/edit.html.haml | 26 ++++++++-- app/views/auth/registrations/new.html.haml | 52 ++++++++++++++++--- app/views/auth/sessions/new.html.haml | 20 +++++-- .../_otp_authentication_form.html.haml | 7 ++- app/views/auth/setup/show.html.haml | 5 +- 12 files changed, 130 insertions(+), 28 deletions(-) diff --git a/.haml-lint_todo.yml b/.haml-lint_todo.yml index 13ee2baaabe..ac9f7637588 100644 --- a/.haml-lint_todo.yml +++ b/.haml-lint_todo.yml @@ -1,16 +1,14 @@ # This configuration was generated by # `haml-lint --auto-gen-config` -# on 2024-01-09 10:00:31 -0500 using Haml-Lint version 0.53.0. +# on 2024-01-09 10:48:44 -0500 using Haml-Lint version 0.53.0. # The point is for the user to remove these configuration records # one by one as the lints are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of Haml-Lint, may require this file to be generated again. linters: - # Offense count: 5 + # Offense count: 3 LineLength: exclude: - 'app/views/admin/roles/_form.html.haml' - - 'app/views/auth/registrations/edit.html.haml' - - 'app/views/auth/registrations/new.html.haml' - 'app/views/media/player.html.haml' diff --git a/app/views/auth/challenges/new.html.haml b/app/views/auth/challenges/new.html.haml index 4f21e4af6e7..50dcebb00cf 100644 --- a/app/views/auth/challenges/new.html.haml +++ b/app/views/auth/challenges/new.html.haml @@ -5,7 +5,11 @@ = f.input :return_to, as: :hidden .field-group - = f.input :current_password, wrapper: :with_block_label, input_html: { autocomplete: 'current-password', autofocus: true }, label: t('challenge.prompt'), required: true + = f.input :current_password, + input_html: { autocomplete: 'current-password', autofocus: true }, + label: t('challenge.prompt'), + required: true, + wrapper: :with_block_label .actions = f.button :button, t('challenge.confirm'), type: :submit diff --git a/app/views/auth/confirmations/new.html.haml b/app/views/auth/confirmations/new.html.haml index 0cb82a1f86a..eaa9d9add09 100644 --- a/app/views/auth/confirmations/new.html.haml +++ b/app/views/auth/confirmations/new.html.haml @@ -21,7 +21,13 @@ = render 'shared/error_messages', object: resource .fields-group - = f.input :email, autofocus: true, wrapper: :with_label, label: t('simple_form.labels.defaults.email'), input_html: { 'aria-label': t('simple_form.labels.defaults.email') }, readonly: current_user.present?, hint: current_user.present? && t('auth.confirmations.wrong_email_hint') + = f.input :email, + autofocus: true, + hint: current_user.present? && t('auth.confirmations.wrong_email_hint'), + input_html: { 'aria-label': t('simple_form.labels.defaults.email') }, + label: t('simple_form.labels.defaults.email'), + readonly: current_user.present?, + wrapper: :with_label .actions = f.button :button, t('auth.resend_confirmation'), type: :submit diff --git a/app/views/auth/passwords/edit.html.haml b/app/views/auth/passwords/edit.html.haml index b95a9b676bf..a75dc2d9fb3 100644 --- a/app/views/auth/passwords/edit.html.haml +++ b/app/views/auth/passwords/edit.html.haml @@ -8,9 +8,18 @@ = f.input :reset_password_token, as: :hidden .fields-group - = f.input :password, wrapper: :with_label, autofocus: true, label: t('simple_form.labels.defaults.new_password'), input_html: { 'aria-label': t('simple_form.labels.defaults.new_password'), autocomplete: 'new-password', minlength: User.password_length.first, maxlength: User.password_length.last }, required: true + = f.input :password, + autofocus: true, + input_html: { 'aria-label': t('simple_form.labels.defaults.new_password'), autocomplete: 'new-password', minlength: User.password_length.first, maxlength: User.password_length.last }, + label: t('simple_form.labels.defaults.new_password'), + required: true, + wrapper: :with_label .fields-group - = f.input :password_confirmation, wrapper: :with_label, label: t('simple_form.labels.defaults.confirm_new_password'), input_html: { 'aria-label': t('simple_form.labels.defaults.confirm_new_password'), autocomplete: 'new-password' }, required: true + = f.input :password_confirmation, + input_html: { 'aria-label': t('simple_form.labels.defaults.confirm_new_password'), autocomplete: 'new-password' }, + label: t('simple_form.labels.defaults.confirm_new_password'), + required: true, + wrapper: :with_label .actions = f.button :button, t('auth.set_new_password'), type: :submit diff --git a/app/views/auth/passwords/new.html.haml b/app/views/auth/passwords/new.html.haml index 10ad108eafa..8d5adaf3b98 100644 --- a/app/views/auth/passwords/new.html.haml +++ b/app/views/auth/passwords/new.html.haml @@ -5,7 +5,12 @@ = render 'shared/error_messages', object: resource .fields-group - = f.input :email, autofocus: true, wrapper: :with_label, label: t('simple_form.labels.defaults.email'), input_html: { 'aria-label': t('simple_form.labels.defaults.email') }, hint: false + = f.input :email, + autofocus: true, + hint: false, + input_html: { 'aria-label': t('simple_form.labels.defaults.email') }, + label: t('simple_form.labels.defaults.email'), + wrapper: :with_label .actions = f.button :button, t('auth.reset_password'), type: :submit diff --git a/app/views/auth/registrations/_account_warning.html.haml b/app/views/auth/registrations/_account_warning.html.haml index 40e7e12968b..19e5746ff63 100644 --- a/app/views/auth/registrations/_account_warning.html.haml +++ b/app/views/auth/registrations/_account_warning.html.haml @@ -5,7 +5,9 @@ = fa_icon 'warning' .log-entry__content .log-entry__title - = t('disputes.strikes.title', action: t(account_warning.action, scope: 'disputes.strikes.title_actions'), date: l(account_warning.created_at.to_date)) + = t 'disputes.strikes.title', + action: t(account_warning.action, scope: 'disputes.strikes.title_actions'), + date: l(account_warning.created_at.to_date) .log-entry__timestamp %time.formatted{ datetime: account_warning.created_at.iso8601 }= l(account_warning.created_at) diff --git a/app/views/auth/registrations/_session.html.haml b/app/views/auth/registrations/_session.html.haml index 28499a7c91c..2fa7db70c7b 100644 --- a/app/views/auth/registrations/_session.html.haml +++ b/app/views/auth/registrations/_session.html.haml @@ -3,7 +3,9 @@ %span{ title: session.user_agent }< = fa_icon "#{session_device_icon(session)} fw", 'aria-label': session_device_icon(session)   - = t 'sessions.description', browser: t("sessions.browsers.#{session.browser}", default: session.browser.to_s), platform: t("sessions.platforms.#{session.platform}", default: session.platform.to_s) + = t 'sessions.description', + browser: t("sessions.browsers.#{session.browser}", default: session.browser.to_s), + platform: t("sessions.platforms.#{session.platform}", default: session.platform.to_s) %td %samp= session.ip %td diff --git a/app/views/auth/registrations/edit.html.haml b/app/views/auth/registrations/edit.html.haml index f5ef4e97e40..48350f478e8 100644 --- a/app/views/auth/registrations/edit.html.haml +++ b/app/views/auth/registrations/edit.html.haml @@ -15,15 +15,33 @@ - if (!use_seamless_external_login? || resource.encrypted_password.present?) && !omniauth_only? .fields-row .fields-row__column.fields-group.fields-row__column-6 - = f.input :email, wrapper: :with_label, input_html: { 'aria-label': t('simple_form.labels.defaults.email') }, required: true, disabled: current_account.suspended? + = f.input :email, + disabled: current_account.suspended?, + input_html: { 'aria-label': t('simple_form.labels.defaults.email') }, + required: true, + wrapper: :with_label .fields-row__column.fields-group.fields-row__column-6 - = f.input :current_password, wrapper: :with_label, input_html: { 'aria-label': t('simple_form.labels.defaults.current_password'), autocomplete: 'current-password' }, required: true, disabled: current_account.suspended?, hint: false + = f.input :current_password, + disabled: current_account.suspended?, + hint: false, + input_html: { 'aria-label': t('simple_form.labels.defaults.current_password'), autocomplete: 'current-password' }, + required: true, + wrapper: :with_label .fields-row .fields-row__column.fields-group.fields-row__column-6 - = f.input :password, wrapper: :with_label, label: t('simple_form.labels.defaults.new_password'), input_html: { 'aria-label': t('simple_form.labels.defaults.new_password'), autocomplete: 'new-password', minlength: User.password_length.first, maxlength: User.password_length.last }, hint: t('simple_form.hints.defaults.password'), disabled: current_account.suspended? + = f.input :password, + disabled: current_account.suspended?, + hint: t('simple_form.hints.defaults.password'), + input_html: { 'aria-label': t('simple_form.labels.defaults.new_password'), autocomplete: 'new-password', minlength: User.password_length.first, maxlength: User.password_length.last }, + label: t('simple_form.labels.defaults.new_password'), + wrapper: :with_label .fields-row__column.fields-group.fields-row__column-6 - = f.input :password_confirmation, wrapper: :with_label, label: t('simple_form.labels.defaults.confirm_new_password'), input_html: { 'aria-label': t('simple_form.labels.defaults.confirm_new_password'), autocomplete: 'new-password' }, disabled: current_account.suspended? + = f.input :password_confirmation, + disabled: current_account.suspended?, + input_html: { 'aria-label': t('simple_form.labels.defaults.confirm_new_password'), autocomplete: 'new-password' }, + label: t('simple_form.labels.defaults.confirm_new_password'), + wrapper: :with_label .actions = f.button :button, t('generic.save_changes'), type: :submit, class: 'button', disabled: current_account.suspended? diff --git a/app/views/auth/registrations/new.html.haml b/app/views/auth/registrations/new.html.haml index 4cac7b51bd0..1e5aac2976a 100644 --- a/app/views/auth/registrations/new.html.haml +++ b/app/views/auth/registrations/new.html.haml @@ -19,25 +19,61 @@ .fields-group = f.simple_fields_for :account do |ff| - = ff.input :username, wrapper: :with_label, label: false, required: true, input_html: { 'aria-label': t('simple_form.labels.defaults.username'), autocomplete: 'off', placeholder: t('simple_form.labels.defaults.username'), pattern: '[a-zA-Z0-9_]+', maxlength: 30 }, append: "@#{site_hostname}" - = f.input :email, placeholder: t('simple_form.labels.defaults.email'), required: true, input_html: { 'aria-label': t('simple_form.labels.defaults.email'), autocomplete: 'username' }, hint: false - = f.input :password, placeholder: t('simple_form.labels.defaults.password'), required: true, input_html: { 'aria-label': t('simple_form.labels.defaults.password'), autocomplete: 'new-password', minlength: User.password_length.first, maxlength: User.password_length.last }, hint: false - = f.input :password_confirmation, placeholder: t('simple_form.labels.defaults.confirm_password'), required: true, input_html: { 'aria-label': t('simple_form.labels.defaults.confirm_password'), autocomplete: 'new-password' }, hint: false - = f.input :confirm_password, as: :string, placeholder: t('simple_form.labels.defaults.honeypot', label: t('simple_form.labels.defaults.password')), required: false, input_html: { 'aria-label': t('simple_form.labels.defaults.honeypot', label: t('simple_form.labels.defaults.password')), autocomplete: 'off' }, hint: false - = f.input :website, as: :url, wrapper: :with_label, label: t('simple_form.labels.defaults.honeypot', label: 'Website'), required: false, input_html: { 'aria-label': t('simple_form.labels.defaults.honeypot', label: 'Website'), autocomplete: 'off' } + = ff.input :username, + append: "@#{site_hostname}", + input_html: { 'aria-label': t('simple_form.labels.defaults.username'), autocomplete: 'off', placeholder: t('simple_form.labels.defaults.username'), pattern: '[a-zA-Z0-9_]+', maxlength: 30 }, + label: false, + required: true, + wrapper: :with_label + = f.input :email, + hint: false, + input_html: { 'aria-label': t('simple_form.labels.defaults.email'), autocomplete: 'username' }, + placeholder: t('simple_form.labels.defaults.email'), + required: true + = f.input :password, + hint: false, + input_html: { 'aria-label': t('simple_form.labels.defaults.password'), autocomplete: 'new-password', minlength: User.password_length.first, maxlength: User.password_length.last }, + placeholder: t('simple_form.labels.defaults.password'), + required: true + = f.input :password_confirmation, + hint: false, + input_html: { 'aria-label': t('simple_form.labels.defaults.confirm_password'), autocomplete: 'new-password' }, + placeholder: t('simple_form.labels.defaults.confirm_password'), + required: true + = f.input :confirm_password, + as: :string, + hint: false, + input_html: { 'aria-label': t('simple_form.labels.defaults.honeypot', label: t('simple_form.labels.defaults.password')), autocomplete: 'off' }, + placeholder: t('simple_form.labels.defaults.honeypot', label: t('simple_form.labels.defaults.password')), + required: false + = f.input :website, + as: :url, + input_html: { 'aria-label': t('simple_form.labels.defaults.honeypot', label: 'Website'), autocomplete: 'off' }, + label: t('simple_form.labels.defaults.honeypot', label: 'Website'), + required: false, + wrapper: :with_label - if approved_registrations? && @invite.blank? %p.lead= t('auth.sign_up.manual_review', domain: site_hostname) .fields-group = f.simple_fields_for :invite_request, resource.invite_request || resource.build_invite_request do |invite_request_fields| - = invite_request_fields.input :text, as: :text, wrapper: :with_block_label, required: Setting.require_invite_text, label: false, hint: false + = invite_request_fields.input :text, + as: :text, + hint: false, + label: false, + required: Setting.require_invite_text, + wrapper: :with_block_label = hidden_field_tag :accept, params[:accept] = f.input :invite_code, as: :hidden .fields-group - = f.input :agreement, as: :boolean, wrapper: :with_label, label: t('auth.privacy_policy_agreement_html', rules_path: about_more_path, privacy_policy_path: privacy_policy_path), required: true + = f.input :agreement, + as: :boolean, + label: t('auth.privacy_policy_agreement_html', rules_path: about_more_path, privacy_policy_path: privacy_policy_path), + required: true, + wrapper: :with_label .actions = f.button :button, @invite.present? ? t('auth.register') : sign_up_message, type: :submit diff --git a/app/views/auth/sessions/new.html.haml b/app/views/auth/sessions/new.html.haml index 7914e0157fa..89903581a2b 100644 --- a/app/views/auth/sessions/new.html.haml +++ b/app/views/auth/sessions/new.html.haml @@ -10,11 +10,25 @@ %p.lead= t('auth.sign_in.preamble_html', domain: site_hostname) .fields-group - if use_seamless_external_login? - = f.input :email, autofocus: true, wrapper: :with_label, label: t('simple_form.labels.defaults.username_or_email'), input_html: { 'aria-label': t('simple_form.labels.defaults.username_or_email') }, hint: false + = f.input :email, + autofocus: true, + hint: false, + input_html: { 'aria-label': t('simple_form.labels.defaults.username_or_email') }, + label: t('simple_form.labels.defaults.username_or_email'), + wrapper: :with_label - else - = f.input :email, autofocus: true, wrapper: :with_label, label: t('simple_form.labels.defaults.email'), input_html: { 'aria-label': t('simple_form.labels.defaults.email') }, hint: false + = f.input :email, + autofocus: true, + hint: false, + input_html: { 'aria-label': t('simple_form.labels.defaults.email') }, + label: t('simple_form.labels.defaults.email'), + wrapper: :with_label .fields-group - = f.input :password, wrapper: :with_label, label: t('simple_form.labels.defaults.password'), input_html: { 'aria-label': t('simple_form.labels.defaults.password'), autocomplete: 'current-password' }, hint: false + = f.input :password, + hint: false, + input_html: { 'aria-label': t('simple_form.labels.defaults.password'), autocomplete: 'current-password' }, + label: t('simple_form.labels.defaults.password'), + wrapper: :with_label .actions = f.button :button, t('auth.login'), type: :submit diff --git a/app/views/auth/sessions/two_factor/_otp_authentication_form.html.haml b/app/views/auth/sessions/two_factor/_otp_authentication_form.html.haml index 8cc2c856103..30e97a68c11 100644 --- a/app/views/auth/sessions/two_factor/_otp_authentication_form.html.haml +++ b/app/views/auth/sessions/two_factor/_otp_authentication_form.html.haml @@ -5,7 +5,12 @@ %p.hint.authentication-hint= t('simple_form.hints.sessions.otp') .fields-group - = f.input :otp_attempt, type: :number, wrapper: :with_label, label: t('simple_form.labels.defaults.otp_attempt'), input_html: { 'aria-label': t('simple_form.labels.defaults.otp_attempt'), autocomplete: 'one-time-code' }, autofocus: true + = f.input :otp_attempt, + autofocus: true, + input_html: { 'aria-label': t('simple_form.labels.defaults.otp_attempt'), autocomplete: 'one-time-code' }, + label: t('simple_form.labels.defaults.otp_attempt'), + type: :number, + wrapper: :with_label .actions = f.button :button, t('auth.login'), type: :submit diff --git a/app/views/auth/setup/show.html.haml b/app/views/auth/setup/show.html.haml index 97c826d704e..713f77470d3 100644 --- a/app/views/auth/setup/show.html.haml +++ b/app/views/auth/setup/show.html.haml @@ -16,7 +16,10 @@ %p.lead= t('auth.setup.email_below_hint_html') .fields-group - = f.input :email, required: true, hint: false, input_html: { 'aria-label': t('simple_form.labels.defaults.email'), autocomplete: 'off' } + = f.input :email, + hint: false, + input_html: { 'aria-label': t('simple_form.labels.defaults.email'), autocomplete: 'off' }, + required: true .actions = f.button :button, t('auth.resend_confirmation'), type: :submit, class: 'button timer-button', disabled: true