diff --git a/tfweb/src/lib/i18n/en.json b/tfweb/src/lib/i18n/en.json index a93c64c..440364e 100644 --- a/tfweb/src/lib/i18n/en.json +++ b/tfweb/src/lib/i18n/en.json @@ -15,8 +15,25 @@ "subtitle": "We'll send you an email with a \"magic link\".", "prompt": "What's your email?", "actionButtonText": "Log in", + "createaccount": "create an account", "apierror": { - "authorization was provided but it is expired or invalid": "User does not exist, maybe consider creating an account?" + "authorization was provided but it is expired or invalid": "User does not exist, maybe consider creating an account?", + "xhrerror": "unable to contact server, please try again later" } + }, + + "signup": { + "title": "Get started with trifid", + "subtitle": "Simply manage connectivity between hosts running any major OS.", + "prompt": "What is your email address?", + "actionButtonText": "Create account", + "login": "Already have an account?", + "sentMagicLink": "Check your email!", + "magicLinkExplainer": "We sent you a link, click on it to finish creating your account." + }, + + "magiclink": { + "loadtitle": "Verifying magic link...", + "loadsubtitle": "Hang on while we check this link." } } \ 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 bb0b9e8..1ab147a 100644 --- a/tfweb/src/routes/auth/login/+page.svelte +++ b/tfweb/src/routes/auth/login/+page.svelte @@ -15,12 +15,19 @@ isloading = true; let xhr = new XMLHttpRequest(); + xhr.timeout = 10000; xhr.open('POST', `${API_ROOT}/v1/auth/magic-link`); xhr.setRequestHeader("Content-Type", "application/json"); xhr.send(JSON.stringify({ email: email })); + xhr.ontimeout = () => { + hasError = true; + error = t('login.apierror.timeout'); + isloading = false; + }; + xhr.onload = () => { if (xhr.status != 200) { // error @@ -35,6 +42,12 @@ isFinished = true; } }; + + xhr.onerror = () => { + hasError = true; + error = t('login.apierror.xhrerror'); + isloading = false; + }; } @@ -71,6 +84,10 @@ {/if} + +
{:else} diff --git a/tfweb/src/routes/auth/magic-link/+page.svelte b/tfweb/src/routes/auth/magic-link/+page.svelte new file mode 100644 index 0000000..029c025 --- /dev/null +++ b/tfweb/src/routes/auth/magic-link/+page.svelte @@ -0,0 +1,17 @@ + + +