Files
simple-aircraft-manager-rails/app/views/two_factors/new.html.erb
T
rickyandClaude Opus 5.5 14316bb60f Sign-in hardening: lockout, stronger passwords, authenticator codes
- 10 failed sign-ins in a row (password, authenticator code, or password
  at signing) lock an account for 15 minutes from any address; the user
  is emailed; admins can unlock. Same message as a wrong password.
- Passwords: at least 12 characters (max 72), refused if found in Have I
  Been Pwned (k-anonymity range API; fails open; PWNED_PASSWORDS_CHECK=false)
- Optional TOTP (authenticator app) with 10 recovery codes for password
  and emailed-link sign-in, and at signing (auth method password_totp);
  codes accepted once; admins can reset; SSO sign-in unaffected
- Demo/test passwords updated; guide, README and procedures document

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 15:17:56 -05:00

18 lines
1.4 KiB
ERB

<% content_for :title, "Set up two-factor" %>
<section class="card card-body mx-auto max-w-md space-y-4">
<h1 class="text-2xl font-bold">Set up an authenticator app</h1>
<p class="text-sm text-slate-600">After your password (or an emailed sign-in link) you'll also enter a 6-digit code from an app on your phone, so a stolen password alone can't get in. Any authenticator app works: Google Authenticator, Microsoft Authenticator, 1Password, Authy…</p>
<ol class="list-decimal space-y-3 pl-5 text-sm">
<li>In the app, add an account and scan this code:
<div class="mt-2 inline-block rounded bg-white p-2"><%= image_tag @qr_data_uri, alt: "QR code for your authenticator app", class: "h-48 w-48" %></div>
<p class="mt-1 text-xs text-slate-500">Can't scan it? Enter this key instead: <code class="break-all"><%= @secret.scan(/.{4}/).join(" ") %></code></p></li>
<li>Enter the code the app shows:
<%= form_with url: two_factor_path, class: "mt-2 flex flex-wrap items-end gap-2" do |f| %>
<%= hidden_field_tag :return_to, params[:return_to] %>
<%= f.text_field :code, required: true, autocomplete: "one-time-code", inputmode: "numeric", maxlength: 7, class: "input w-32 text-lg tracking-widest", "aria-label": "Code" %>
<%= f.submit "Turn on", class: "btn-primary" %>
<% end %></li>
</ol>
<p class="text-sm"><%= link_to "Not now", back_path, class: "link" %></p>
</section>