diff --git a/app/forms/edit_phone_form.rb b/app/forms/edit_phone_form.rb index f014de1462e..4e3b615fdd4 100644 --- a/app/forms/edit_phone_form.rb +++ b/app/forms/edit_phone_form.rb @@ -33,6 +33,10 @@ def default_phone_configuration? phone_configuration == user.default_phone_configuration end + def one_phone_configured? + user.phone_configurations.count == 1 + end + private attr_writer :delivery_preference, :make_default_number diff --git a/app/views/accounts/_phone.html.erb b/app/views/accounts/_phone.html.erb index 2536b162cc7..a9eaf9bb540 100644 --- a/app/views/accounts/_phone.html.erb +++ b/app/views/accounts/_phone.html.erb @@ -10,7 +10,7 @@
<%= PhoneFormatter.format(phone_configuration.phone) %> - <% if current_user.default_phone_configuration == phone_configuration %> + <% if current_user.default_phone_configuration == phone_configuration && MfaContext.new(current_user).phone_configurations.count > 1 %> (<%= I18n.t('account.index.default') %>) <% end %>
diff --git a/app/views/users/edit_phone/_make_default_number.html.erb b/app/views/users/edit_phone/_make_default_number.html.erb index 0b68b2faf71..1f553071e31 100644 --- a/app/views/users/edit_phone/_make_default_number.html.erb +++ b/app/views/users/edit_phone/_make_default_number.html.erb @@ -1,16 +1,25 @@
- <%= t('two_factor_authentication.otp_make_default_number.title') %> + <% if @edit_phone_form.one_phone_configured? %> + <%= t('two_factor_authentication.otp_make_default_number.one_number_title') %> + <% else %> + <%= t('two_factor_authentication.otp_make_default_number.title') %> + <% end %> -

- <%= t('two_factor_authentication.otp_make_default_number.instruction') %> +

+ <% if @edit_phone_form.one_phone_configured? %> + <%= t('two_factor_authentication.otp_make_default_number.one_number_instruction') %> + <% else %> + <%= t('two_factor_authentication.otp_make_default_number.instruction') %> + <% end %>

<%= check_box_tag( 'edit_phone_form[make_default_number]', :otp_make_default_number, @edit_phone_form.default_phone_configuration?, class: 'usa-checkbox__input usa-checkbox__input--bordered', + disabled: @edit_phone_form.one_phone_configured?, ) %>