18F/identity-idp

View on GitHub
app/views/users/two_factor_authentication_setup/index.html.erb

Summary

Maintainability
Test Coverage
<% self.title = t('titles.two_factor_setup') %>

<%= render(VendorOutageAlertComponent.new(vendors: [:sms, :voice], context: :voice, only_if_all: true)) %>

<% if @presenter.icon %>
  <%= image_tag(
        asset_url(@presenter.icon),
        class: 'margin-bottom-3',
        alt: @presenter.icon_alt_text,
      ) %>
<% end %>

<%= render PageHeadingComponent.new.with_content(@presenter.heading) %>

<p><%= @presenter.intro %></p>

<p><%= t('mfa.recommendation') %></p>

<% if @presenter.two_factor_enabled? %>
  <h2 class="margin-top-2 margin-bottom-1">
    <%= t('headings.account.two_factor') %>
  </h2>

  <%= render IconListComponent.new(icon: :check_circle, color: :success) do |c| %>
    <% @presenter.all_options_sorted.each do |option| %>
      <% if option.mfa_configuration_count > 0 %>
        <% c.with_item do %>
          <%= option.label %> <%= option.mfa_added_label %>
        <% end %>
      <% end %>
    <% end %>
  <% end %>
<% end %>

<%= simple_form_for @two_factor_options_form,
                    method: :patch,
                    url: authentication_methods_setup_path do |f| %>
  <div class="margin-bottom-4">
    <fieldset class="margin-0 padding-0 border-0">
      <legend class="margin-bottom-2 usa-sr-only">
        <%= t('two_factor_authentication.form_legend') %>
      </legend>
      <% @presenter.options.each do |option| %>
        <%= render(option) do %>
          <%= render partial: 'partials/multi_factor_authentication/mfa_selection',
                     locals: { option: option } %>
        <% end %>
      <% end %>
    </fieldset>
  </div>

  <%= f.submit t('forms.buttons.continue'), class: 'margin-bottom-1' %>
<% end %>

<% if @presenter.skip_path || !@presenter.two_factor_enabled? %>
  <%= render PageFooterComponent.new do %>
    <% if @presenter.skip_path %>
      <%= link_to @presenter.skip_label, @presenter.skip_path %>
    <% elsif !@presenter.two_factor_enabled? %>
      <%= link_to t('links.cancel_account_creation'), sign_up_cancel_path %>
    <% end %>
  <% end %>
<% end %>