- {#if step == 1}
- Please authenticate with your Webauthn Device to finish deletion.
-
-
-
- {:else if step == 2}
- Enter your recovery code to finish deletion.
-
-
-
- {/if}
-
-
-
-
- {#if step == 1}
-
-
- {:else if step == 2}
-
-
- {/if}
-
-
diff --git a/src/routes/console/account/updateMfa.svelte b/src/routes/console/account/updateMfa.svelte
index 2cf286c37..a4a1584df 100644
--- a/src/routes/console/account/updateMfa.svelte
+++ b/src/routes/console/account/updateMfa.svelte
@@ -15,7 +15,6 @@
import MfaRegenerateCodes from './mfaRegenerateCodes.svelte';
import { Pill } from '$lib/elements';
import WebauthnMfa from './webauthnMfa.svelte';
- import DeleteWebauthn from './deleteWebauthn.svelte';
let showSetup: boolean = false;
let showDelete: boolean = false;
@@ -78,6 +77,24 @@
}
}
+ async function deleteWebauthnAuthenticator() {
+ try {
+ await sdk.forConsole.webauthnAccount.deleteMfaAuthenticator('webauthn');
+ Promise.all([invalidate(Dependencies.ACCOUNT), invalidate(Dependencies.FACTORS)]);
+ trackEvent(Submit.AccountAuthenticatorDelete);
+ addNotification({
+ type: 'success',
+ message: 'Webauthn authenticator has been deleted'
+ });
+ } catch (error) {
+ addNotification({
+ type: 'error',
+ message: error.message
+ });
+ trackError(error, Submit.AccountAuthenticatorDelete);
+ }
+ }
+
$: if (!showRecoveryCodes) {
codes = null;
}
@@ -162,12 +179,12 @@