This uses the new part plugin to simplify and optimize render calls with locals. ```ruby render(:template, locals: {foo: 'bar'}) part(:template, foo: 'bar') ``` This simplifies a large number of calls in Clover, since rendering with locals is one of the most common method calls in the templates. The main advantage of this is simplicity, but the part method is also more optimized, and will be even more optimized when we upgrade to Ruby 3.4. Diff best reviewed with: ``` git diff -b --color-words --word-diff-regex='\\w+|[^[:space:]]' ```
41 lines
2.1 KiB
Plaintext
41 lines
2.1 KiB
Plaintext
<% @page_title = "Setup One-Time Password" %>
|
|
|
|
<%== part("components/page_header", 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 %>
|
|
<%== part("components/form/submit_button", text: rodauth.otp_setup_button) %>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</main>
|