Two-factor sign-in
The setup screen of two-factor sign-in: the QR code, the key to type in and the recovery codes.
zb:two-factor-qr · zb:recovery-codes zubazar/ui · free (MIT)
QR code and key
BLADE
Put the QR code (SVG) in the slot; secret shows the key next to it in groups of four.
<zb:two-factor-qr secret="JBSWY3DPEHPK3PXP">
<svg viewBox="0 0 21 21" fill="currentColor" class="text-gray-900"><path d="M0 0h7v7H0zM14 0h7v7h-7zM0 14h7v7H0zM2 2v3h3V2zM16 2v3h3V2zM2 16v3h3v-3zM9 0h2v2H9zM9 4h2v4H9zM11 9h2v2h-2zM14 9h2v3h-2zM9 12h3v2H9zM18 12h3v2h-3zM14 14h2v2h-2zM16 16h3v2h-3zM9 16h2v5H9zM12 18h2v3h-2z"/></svg>
</zb:two-factor-qr>
| Prop | Values |
|---|---|
secret | The setup key |
label | The QR code's name for screen readers |
Recovery codes
BLADE
The codes are listed in a monospaced font; Copy puts them all on the clipboard and Download gives a text file.
<zb:recovery-codes :codes="['k7m2-x9qp', 'r4t8-w2zc', 'b6n1-h5vd', 'q3s7-f8ly', 'p2j9-u4ke', 'c8g5-a1ro']" filename="acme-recovery-codes.txt" />
| Prop | Values |
|---|---|
codes | The list of codes |
filename | The name of the downloaded file |
Props
The values the component takes. What are props and slots?
| Prop | Type | Default | Description |
|---|---|---|---|
two-factor-qr: secret | — | null | The setup key to type in |
two-factor-qr: label | — | null | The QR code's name for screen readers |
recovery-codes: codes | — | [] | The recovery codes |
recovery-codes: filename | — | recovery-codes.txt | The name of the downloaded file |
Slots: two-factor-qr: the default slot is the QR code's SVG.
Developer notes
- Your application's library (e.g. Fortify) creates the codes and the QR code; the kit only shows them.
- The QR code stays in a white frame in dark mode too, so a phone camera can read it.
- The Copy button announces the result to screen readers.