diff --git a/tfweb/src/lib/i18n/locales/en.json b/tfweb/src/lib/i18n/locales/en.json index f41b168..c1e6c62 100644 --- a/tfweb/src/lib/i18n/locales/en.json +++ b/tfweb/src/lib/i18n/locales/en.json @@ -65,7 +65,10 @@ "title": "Authenticate with TOTP", "subtitle": "Enter the 6-digit code displayed in your authenticator app", "label": "TOTP Code", - "button": "Verify" + "button": "Verify", + "error": { + "ERR_UNAUTHORIZED": "Invalid 2FA code" + } }, "networkcreate": { "title": "Create your network", diff --git a/tfweb/src/routes/2fa/+page.svelte b/tfweb/src/routes/2fa/+page.svelte index a526020..1e7bd9e 100644 --- a/tfweb/src/routes/2fa/+page.svelte +++ b/tfweb/src/routes/2fa/+page.svelte @@ -10,7 +10,7 @@ let loading = true; let isError = false; let error = ''; - $: currentlyLoading = $isLoading || loading; + $: currentlyLoading = $isLoading; logSetup(); let logger = new Logger("2fa/+page.svelte"); @@ -43,7 +43,6 @@ if (create_res[0] == APIResult.Failed) { logger.error(`totp auth fail`); - isError = true; let err = create_res[1] as APIError; let etext = err.code; @@ -55,7 +54,8 @@ return; } - error = $t('2fasetup.error.generic', {values:{err:etext}}); + errForm = $t('2fa.error.' + etext); + hasErrForm = true; loading = false; return; } @@ -71,14 +71,31 @@ -

{$t('2fa.title')}

-

{$t('2fa.subtitle')}

-
- - - - {#if hasErrForm} -

{errForm}

- {/if} -
+ +
+
+
+

{$t('2fa.title')}

+

{$t('2fa.subtitle')}

+ +
+ + + + {#if loading} + + {:else} + + {/if} + + {#if hasErrForm} +

{errForm}

+ {/if} +
+
+
+
+ + +