From 45b8e78ee2c587cb7dcfaf76772fc64aedaad4c0 Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Thu, 29 Feb 2024 14:32:45 +0100 Subject: [PATCH] fix: mfa screen --- src/lib/images/qr2.svg | 18 ++++ src/routes/console/account/mfa.svelte | 94 +++++++++++---------- src/routes/console/account/updateMfa.svelte | 4 +- 3 files changed, 71 insertions(+), 45 deletions(-) create mode 100644 src/lib/images/qr2.svg diff --git a/src/lib/images/qr2.svg b/src/lib/images/qr2.svg new file mode 100644 index 000000000..b106c2e2b --- /dev/null +++ b/src/lib/images/qr2.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/routes/console/account/mfa.svelte b/src/routes/console/account/mfa.svelte index 11d8db720..4aa5f71c7 100644 --- a/src/routes/console/account/mfa.svelte +++ b/src/routes/console/account/mfa.svelte @@ -9,13 +9,15 @@ import { addNotification } from '$lib/stores/notifications'; import { sdk } from '$lib/stores/sdk'; import { AuthenticatorType, type Models } from '@appwrite.io/console'; - + import QrFrame from '$lib/images/qr2.svg'; export let showSetup = false; export let showRecoveryCodes = false; let copyParent: HTMLElement; let code: string; let type: Models.MfaType = null; + let step = 1; + async function addAuthenticator(): Promise { type = await sdk.forConsole.account.addAuthenticator(AuthenticatorType.Totp); @@ -49,52 +51,59 @@ Install an authenticator app on your mobile device, open it and scan the provided QR code or enter it manually.

+ {#if step === 1} + {#await addAuthenticator()} +
+
+
+ {:then qr} +
+ MFA QR Code +
+ or - {#await addAuthenticator()} -
- -
- {:then qr} -
- MFA QR Code -
- or +
+ + -
- - - -
- -
-
+
+ +
{#key copyParent} - + {/key}
-
- {/await} - -
- - - - + {/await} + {:else} + + + + + {/if} {/key} - + {#if step === 1} + + {:else} + + {/if} @@ -161,6 +170,12 @@ diff --git a/src/routes/console/account/updateMfa.svelte b/src/routes/console/account/updateMfa.svelte index 140943222..28ebea5d5 100644 --- a/src/routes/console/account/updateMfa.svelte +++ b/src/routes/console/account/updateMfa.svelte @@ -88,5 +88,7 @@ - +{#if showSetup} + +{/if}