Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions frontend/src/routes/user/settings/TwoFaConfirmForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import { Button } from '$lib/components/ui/button';
import { Spinner } from '$lib/components/ui/spinner';
import { logger } from '$lib/config/logger';
import { goto } from '$app/navigation';

const { twoFaSetupData, closeShowTwoFaForm } = $props();

Expand All @@ -39,12 +40,15 @@
};

try {
const user = await twoFaConfirm(payload);
await twoFaConfirm(payload);

userStore.login(user);
toast.success('2FA enabled successfully, please log in again!');

toast.success('2FA enabled successfully!');
userStore.logout();
closeShowTwoFaForm();
setTimeout(() => {
goto('/user/login');
}, 0);
} catch (error) {
if (error instanceof AuthError && error.status === 400) {
setError(form, 'twoFaCode', 'Invalid 2FA code');
Expand Down