From 638ed31b09a573405917e10a8ef6d38a2be41ce6 Mon Sep 17 00:00:00 2001 From: core Date: Mon, 20 Feb 2023 21:56:17 -0500 Subject: [PATCH] login page + i18n --- tfweb/src/lib/i18n/en.json | 5 ++++- tfweb/src/lib/i18n/jp.json | 9 +++++++++ tfweb/src/lib/i18n/nl.json | 9 +++++++++ tfweb/src/routes/auth/login/+page.svelte | 5 ++++- trifid-api/config.toml | 2 +- 5 files changed, 27 insertions(+), 3 deletions(-) diff --git a/tfweb/src/lib/i18n/en.json b/tfweb/src/lib/i18n/en.json index 3397001..a93c64c 100644 --- a/tfweb/src/lib/i18n/en.json +++ b/tfweb/src/lib/i18n/en.json @@ -14,6 +14,9 @@ "title": "Log in to your account", "subtitle": "We'll send you an email with a \"magic link\".", "prompt": "What's your email?", - "actionButtonText": "Log in" + "actionButtonText": "Log in", + "apierror": { + "authorization was provided but it is expired or invalid": "User does not exist, maybe consider creating an account?" + } } } \ No newline at end of file diff --git a/tfweb/src/lib/i18n/jp.json b/tfweb/src/lib/i18n/jp.json index adcd974..e8801ca 100644 --- a/tfweb/src/lib/i18n/jp.json +++ b/tfweb/src/lib/i18n/jp.json @@ -9,5 +9,14 @@ "lightMode": "ライトモード", "darkMode": "ダークモード", "changeLang": "言語の変更" + }, + "login": { + "title": "あなたのアカウントにログイン", + "subtitle": "「マジックリンク」を記載したメールをお送りします。", + "prompt": "あなたのメールは何ですか?", + "actionButtonText": "ログイン", + "apierror": { + "authorization was provided but it is expired or invalid": "ユーザーが存在しません。アカウントの作成を検討してください。" + } } } \ No newline at end of file diff --git a/tfweb/src/lib/i18n/nl.json b/tfweb/src/lib/i18n/nl.json index 0bf95f0..faff0ef 100644 --- a/tfweb/src/lib/i18n/nl.json +++ b/tfweb/src/lib/i18n/nl.json @@ -9,5 +9,14 @@ "lightMode": "Lichtmodus", "darkMode": "Donkere modus", "changeLang": "Taal wijzigen" + }, + "login": { + "title": "Log in op jouw account", + "subtitle": "We sturen je een e-mail met een \"magische link\".", + "prompt": "Wat is jouw e-mail?", + "actionButtonText": "Log in", + "apierror": { + "authorization was provided but it is expired or invalid": "Gebruiker bestaat niet, misschien overwegen om een account aan te maken?" + } } } \ No newline at end of file diff --git a/tfweb/src/routes/auth/login/+page.svelte b/tfweb/src/routes/auth/login/+page.svelte index bfffa73..bb0b9e8 100644 --- a/tfweb/src/routes/auth/login/+page.svelte +++ b/tfweb/src/routes/auth/login/+page.svelte @@ -25,7 +25,10 @@ if (xhr.status != 200) { // error hasError = true; - error = JSON.parse(xhr.responseText).errors[0].message; + const rawerror = JSON.parse(xhr.responseText).errors[0].message; + + error = t(`login.apierror.${rawerror}`); + isloading = false; } else { isloading = false; diff --git a/trifid-api/config.toml b/trifid-api/config.toml index 3e7dd33..fd67d21 100644 --- a/trifid-api/config.toml +++ b/trifid-api/config.toml @@ -1,7 +1,7 @@ listen_port = 8000 db_url = "postgres://postgres@localhost/trifidapi" base = "http://localhost:8000" -web_root = "http://localhost:5173 +web_root = "http://localhost:5173" magic_links_valid_for = 86400 session_tokens_valid_for = 86400 totp_verification_valid_for = 3600 \ No newline at end of file