i18n: localize login page
This commit is contained in:
1 parent
8278cff51e
commit
3d76bb7330
3 files changed
+29
-25
No files matched your search
@@ -18,6 +18,8 @@
|
||||
} from 'svelte-hero-icons'
|
||||
import { DOMAIN_REGEX_FORMS } from '$lib/util.js'
|
||||
import { MINIMUM_VERSION } from '$lib/version.js'
|
||||
import { t } from '$lib/translations'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
let data = {
|
||||
instance: DEFAULT_INSTANCE_URL,
|
||||
@@ -69,14 +71,13 @@
|
||||
<div class="max-w-xl w-full mx-auto h-max my-auto">
|
||||
<form on:submit|preventDefault={logIn} class="flex flex-col gap-5">
|
||||
<div class="flex flex-col gap-2">
|
||||
<h1 class="font-bold text-3xl">Log In</h1>
|
||||
<Header>{$t('account.login')}</Header>
|
||||
{#if $site && mayBeIncompatible(MINIMUM_VERSION, $site.version.replace('v', ''))}
|
||||
<Note>
|
||||
This version of Photon supports instances running
|
||||
<span style="font-family: monospace;">
|
||||
v{MINIMUM_VERSION}
|
||||
</span>
|
||||
or higher.
|
||||
{$t('account.versionGate', {
|
||||
//@ts-ignore
|
||||
version: `v${MINIMUM_VERSION}`,
|
||||
})}
|
||||
</Note>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -84,14 +85,14 @@
|
||||
<TextInput
|
||||
id="username"
|
||||
bind:value={data.username}
|
||||
label="Username"
|
||||
label={$t('form.username')}
|
||||
class="flex-1"
|
||||
required
|
||||
/>
|
||||
{#if !LINKED_INSTANCE_URL}
|
||||
<TextInput
|
||||
id="instance_url"
|
||||
label="Instance URL"
|
||||
label={$t('form.instance')}
|
||||
placeholder={DEFAULT_INSTANCE_URL}
|
||||
disabled={LINKED_INSTANCE_URL != undefined}
|
||||
bind:value={data.instance}
|
||||
@@ -105,7 +106,7 @@
|
||||
<TextInput
|
||||
id="password"
|
||||
bind:value={data.password}
|
||||
label="Password"
|
||||
label={$t('form.password')}
|
||||
type="password"
|
||||
minlength={10}
|
||||
maxlength={60}
|
||||
@@ -115,7 +116,7 @@
|
||||
<TextInput
|
||||
id="totp"
|
||||
bind:value={data.totp}
|
||||
label="2FA Code"
|
||||
label={$t('form.2fa')}
|
||||
placeholder="123456"
|
||||
pattern={'\\d{6}'}
|
||||
minlength={6}
|
||||
@@ -130,21 +131,21 @@
|
||||
size="lg"
|
||||
submit
|
||||
>
|
||||
Log In
|
||||
{$t('account.login')}
|
||||
</Button>
|
||||
<hr class="dark:border-zinc-700" />
|
||||
<div class="flex flex-row items-center gap-2">
|
||||
<Button color="tertiary" href="/signup">
|
||||
<Icon src={Identification} mini size="16" />
|
||||
Sign Up
|
||||
{$t('account.signup')}
|
||||
</Button>
|
||||
<Button color="tertiary" href="/login_reset">
|
||||
<Icon src={QuestionMarkCircle} mini size="16" />
|
||||
Forgot Password
|
||||
{$t('form.forgotpassword')}
|
||||
</Button>
|
||||
<Button color="tertiary" href="/login/guest">
|
||||
<Icon src={UserCircle} mini size="16" />
|
||||
Guest
|
||||
{$t('account.guest')}
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -7,10 +7,12 @@
|
||||
import { profile, profileData, type Profile } from '$lib/auth'
|
||||
import { LINKED_INSTANCE_URL } from '$lib/instance'
|
||||
import { goto } from '$app/navigation'
|
||||
import { t } from '$lib/translations'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
|
||||
let form = {
|
||||
instance: '',
|
||||
username: `Guest ${$profileData.profiles.filter((p) => p.jwt == undefined).length + 1}`,
|
||||
username: `${$t('account.guest')} ${$profileData.profiles.filter((p) => p.jwt == undefined).length + 1}`,
|
||||
loading: false,
|
||||
}
|
||||
|
||||
@@ -53,21 +55,20 @@
|
||||
<div class="max-w-xl w-full mx-auto h-max my-auto">
|
||||
<form on:submit|preventDefault={addGuest} class="flex flex-col gap-5">
|
||||
<div class="flex flex-col gap-2">
|
||||
<h1 class="font-bold text-3xl">Add Guest</h1>
|
||||
<Header>{$t('account.addGuest')}</Header>
|
||||
{#if $site && mayBeIncompatible(MINIMUM_VERSION, $site.version.replace('v', ''))}
|
||||
<Note>
|
||||
This version of Photon supports instances running
|
||||
<span style="font-family: monospace;">
|
||||
v{MINIMUM_VERSION}
|
||||
</span>
|
||||
or higher.
|
||||
{$t('account.versionGate', {
|
||||
//@ts-ignore
|
||||
version: `v${MINIMUM_VERSION}`,
|
||||
})}
|
||||
</Note>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="inline-flex items-center gap-2">
|
||||
<TextInput
|
||||
required
|
||||
label="Name"
|
||||
label={$t('form.name')}
|
||||
bind:value={form.username}
|
||||
placeholder="Guest 2"
|
||||
minlength={1}
|
||||
@@ -76,7 +77,7 @@
|
||||
{#if !LINKED_INSTANCE_URL}
|
||||
<TextInput
|
||||
required
|
||||
label="Instance URL"
|
||||
label={$t('form.instance')}
|
||||
bind:value={form.instance}
|
||||
pattern={DOMAIN_REGEX_FORMS}
|
||||
placeholder="example.com"
|
||||
@@ -92,7 +93,7 @@
|
||||
loading={form.loading}
|
||||
disabled={form.loading}
|
||||
>
|
||||
Submit
|
||||
{$t('form.submit')}
|
||||
</Button>
|
||||
</form>
|
||||
</div>
|
||||
Reference in new issue
Block a user