fix(account): delete mfa

This commit is contained in:
Torsten Dittmann
2024-08-08 14:42:30 +02:00
parent d7f8abc1a0
commit 481ee5f036
@@ -4,20 +4,17 @@
import { Modal } from '$lib/components';
import { Dependencies } from '$lib/constants';
import { Button } from '$lib/elements/forms';
import FormList from '$lib/elements/forms/formList.svelte';
import InputDigits from '$lib/elements/forms/inputDigits.svelte';
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import { AuthenticatorType } from '@appwrite.io/console';
export let showDelete = false;
let code: string;
let error: string;
async function deleteAuthenticator() {
try {
await sdk.forConsole.account.deleteMfaAuthenticator(AuthenticatorType.Totp, code);
await sdk.forConsole.account.deleteMfaAuthenticator(AuthenticatorType.Totp);
await invalidate(Dependencies.ACCOUNT);
await invalidate(Dependencies.FACTORS);
showDelete = false;
@@ -33,7 +30,6 @@
}
$: if (showDelete) {
code = '';
error = '';
}
</script>
@@ -46,10 +42,10 @@
state="warning"
bind:error
headerDivider={false}>
<p>Enter the 6-digit verification code generated by your authenticator app to continue.</p>
<FormList>
<InputDigits autofocus required bind:value={code} autoSubmit={false} />
</FormList>
<p>
Are you sure you want to delete this authentication method? You will no longer be able to
use this method to authenticate your account.
</p>
<svelte:fragment slot="footer">
<Button text on:click={() => (showDelete = false)}>Cancel</Button>