From b4685462ec8171618a5d0cd1642b967a76353582 Mon Sep 17 00:00:00 2001 From: Adrian Gruntkowski Date: Tue, 21 Nov 2023 11:57:13 +0100 Subject: [PATCH] Implement view for initiating 2FA setup --- lib/plausible_web/components/generic.ex | 3 - .../auth/initiate_2fa_setup.html.heex | 66 +++++++++++++++++++ 2 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 lib/plausible_web/templates/auth/initiate_2fa_setup.html.heex diff --git a/lib/plausible_web/components/generic.ex b/lib/plausible_web/components/generic.ex index 754d22154..003e04dbc 100644 --- a/lib/plausible_web/components/generic.ex +++ b/lib/plausible_web/components/generic.ex @@ -252,10 +252,7 @@ defmodule PlausibleWeb.Components.Generic do attr :scale, :integer, default: 4 def qr_code(assigns) do - qr_color = {101, 116, 205} - svg_settings = %QRCode.Render.SvgSettings{ - qrcode_color: qr_color, structure: :readable, scale: assigns.scale } diff --git a/lib/plausible_web/templates/auth/initiate_2fa_setup.html.heex b/lib/plausible_web/templates/auth/initiate_2fa_setup.html.heex new file mode 100644 index 000000000..c15657a70 --- /dev/null +++ b/lib/plausible_web/templates/auth/initiate_2fa_setup.html.heex @@ -0,0 +1,66 @@ +
+
+

+ Setup Two-Factor Authentication +

+ +
+ Link your Plausible account to the authenticator app you have installed either on your phone or computer. +
+
+ <.qr_code text={@totp_uri} /> +
+ +
+
    +
  1. +
    +
    +
    + Open the authenticator application +
  2. +
  3. +
    +
    +
    + Tap Scan a QR Code +
  4. +
  5. +
    +
    +
    + Scan this code with your phone camera +
  6. +
+ +
+

or type in the code manually:

+
<%= @secret %>
+
+
+
+ +
+

+ Changed your mind? + "#setup-2fa"} + class="underline text-indigo-600" + > + Go back to settings + +

+ <.unstyled_link + id="proceed" + class="button" + href={Routes.auth_path(@conn, :verify_2fa_setup_form)} + > + Proceed → + +
+
+
+