<% content_for :title, "Set up two-factor" %>

Set up an authenticator app

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…

  1. In the app, add an account and scan this code:
    <%= image_tag @qr_data_uri, alt: "QR code for your authenticator app", class: "h-48 w-48" %>

    Can't scan it? Enter this key instead: <%= @secret.scan(/.{4}/).join(" ") %>

  2. 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 %>

<%= link_to "Not now", back_path, class: "link" %>