Files
ubicloud/views/account/multifactor/otp_setup.erb
Jeremy Evans 4e76b20b27 Add coverage and fix issues in account/multifactor views
Fixes:

* Fix invalid HTML on recovery code page, caused by nesting h2 in h2

* Remove rodauth.otp_keys_use_hmac? branch, since that is always true in
  our Rodauth configuration.

I moved the closing nocov for Config.test? specific routes to ensure that
those are covered in tests (still need nocov to handle the implied else
branch not taken).

After changes (rebased on main since last commit, so totals have changed):

Line Coverage: 99.39% (11192 / 11261)
Branch Coverage: 97.0% (2841 / 2929)
2025-01-14 09:04:22 -08:00

41 lines
2.1 KiB
Plaintext

<% @page_title = "Setup One-Time Password" %>
<%== render("components/page_header", locals: { title: "My Account" }) %>
<main>
<div class="max-w-screen-xl pb-6 lg:pb-16">
<div class="overflow-hidden rounded-lg bg-white shadow">
<div class="divide-y divide-gray-200 lg:grid lg:grid-cols-12 lg:divide-x lg:divide-y-0">
<%== render("account/submenu") %>
<div class="divide-y divide-gray-200 lg:col-span-8 xl:col-span-9 2xl:col-span-10 pb-10">
<div class="px-4 py-6 sm:p-6 lg:pb-8 space-y-4">
<h2 class="text-lg font-medium leading-6 text-gray-900">Setup One-Time Password Authentication</h2>
<form action="/<%= rodauth.otp_setup_route %>" role="form" method="POST">
<%== rodauth.otp_setup_additional_form_tags %>
<input type="hidden" id="otp-key" name="<%= rodauth.otp_setup_param %>" value="<%= rodauth.otp_user_key %>"/>
<input type="hidden" id="otp-hmac-secretkey" name="<%= rodauth.otp_setup_raw_param %>" value="<%= rodauth.otp_key %>"/>
<%== rodauth.csrf_tag("/" + rodauth.otp_setup_route) %>
<div class="mt-6 grid grid-cols-6 gap-6">
<div class="col-span-6 md:col-span-3">
<%== rodauth.otp_qr_code %>
<p class="mt-2 text-sm text-gray-500 text-center">
If you can't scan the QR code, please enter the following secret in your authenticator app manually: <br>
<span id="otp-secret" class="font-bold break-words"><%= rodauth.otp_user_key %></span>
</p>
</div>
<div class="col-span-6 md:col-span-3 space-y-4">
<%== render("components/rodauth/otp_auth_code_field") %>
<% if rodauth.two_factor_modifications_require_password? %>
<%== render("components/rodauth/password_field") %>
<% end %>
<%== render("components/form/submit_button", locals: { text: rodauth.otp_setup_button }) %>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</main>