defmodule PlausibleWeb.Components.TwoFactor do @moduledoc """ Reusable components specific to 2FA """ use Phoenix.Component attr :text, :string, required: true attr :scale, :integer, default: 4 def qr_code(assigns) do qr_code = assigns.text |> EQRCode.encode() |> EQRCode.svg(%{width: 160}) assigns = assign(assigns, :code, qr_code) ~H""" <%= Phoenix.HTML.raw(@code) %> """ end attr :id, :string, default: "verify-button" attr :form, :any, required: true attr :field, :any, required: true attr :class, :string, default: "" def verify_2fa_input(assigns) do ~H"""