diff --git a/app/javascript/app/form-validation.js b/app/javascript/app/form-validation.js index 69896083384..92c9d12abc4 100644 --- a/app/javascript/app/form-validation.js +++ b/app/javascript/app/form-validation.js @@ -25,7 +25,7 @@ document.addEventListener('DOMContentLoaded', () => { input.addEventListener('input', function () { if (buttons.length !== 0 && input.checkValidity()) { [].forEach.call(buttons, function(button) { - if (button.disabled) { + if (button.disabled && !button.classList.contains('no-auto-enable')) { button.disabled = false; } }); diff --git a/app/views/users/phone_setup/index.html.slim b/app/views/users/phone_setup/index.html.slim index feeef635fc4..ac656e3c452 100644 --- a/app/views/users/phone_setup/index.html.slim +++ b/app/views/users/phone_setup/index.html.slim @@ -20,7 +20,8 @@ p.mt-tiny.mb0 = @presenter.info = f.input :phone, as: :tel, label: false, required: true, input_html: { class: 'phone col-8 mb4' } div - = f.button :submit, t('forms.buttons.send_security_code'), class: 'sm-col-6 col-12 btn-wide mb3' + = f.button :submit, t('forms.buttons.send_security_code'), + class: 'sm-col-6 col-12 btn-wide mb3 no-auto-enable' .mt2.pt1.border-top - path = current_user.piv_cac_enabled? ? account_recovery_setup_path : two_factor_options_path = link_to t('two_factor_authentication.choose_another_option'), path diff --git a/spec/views/phone_setup/index.html.slim_spec.rb b/spec/views/phone_setup/index.html.slim_spec.rb index 895995f36ec..5f50343aac4 100644 --- a/spec/views/phone_setup/index.html.slim_spec.rb +++ b/spec/views/phone_setup/index.html.slim_spec.rb @@ -21,4 +21,9 @@ href: two_factor_options_path ) end + + it 'it has auto enable off for the submit button' do + expect(rendered). + to have_xpath('//input[@type="submit" and contains(@class, "no-auto-enable")]') + end end