i18n: localize profile pages

This commit is contained in:
Xylight committed 2024-06-03 17:53:44 -07:00
1 parent bcc007ad61
commit 96d4e5dd35
3 files changed
+84 -37

No files matched your search

@@ -9,6 +9,8 @@
import { page } from '$app/stores'
import Switch from '$lib/components/input/Switch.svelte'
import { feature } from '$lib/version.js'
import { t } from '$lib/translations.js'
import Header from '$lib/components/ui/layout/pages/Header.svelte'
export let data
@@ -82,50 +84,55 @@
}
</script>
<h1 class="font-bold text-3xl">Credentials</h1>
<h1 class="font-bold text-3xl">{$t('routes.profile.credentials')}</h1>
<div class="flex flex-row flex-wrap gap-8">
<div class="flex flex-col gap-2 max-w-sm w-full">
<h1 class="font-bold text-2xl">Password</h1>
<h1 class="font-bold text-2xl">{$t('form.password')}</h1>
<form
on:submit|preventDefault={changePassword}
class="max-w-sm flex flex-col gap-4"
>
<TextInput
bind:value={oldPassword}
label="Current Password"
label={$t('form.profile.currentPassword')}
type="password"
minlength={10}
required
/>
<TextInput
bind:value={newPassword}
label="New Password"
label={$t('form.profile.newPassword')}
type="password"
minlength={10}
required
/>
<TextInput
bind:value={newPasswordVerify}
label="New Password (Verify)"
label={$t('form.profile.verifyNewPassword')}
type="password"
minlength={10}
required
/>
<Button size="lg" color="primary" submit {loading} disabled={loading}>
Submit
{$t('form.submit')}
</Button>
</form>
</div>
<div class="flex flex-col gap-4 max-w-sm w-full">
<h1 class="font-bold text-2xl">2FA</h1>
<Header>{$t('form.profile.2fa.2fa')}</Header>
<p>
2FA is <span class="font-bold">
{totpEnabled ? 'enabled' : 'disabled'}
<span class="font-bold">
{totpEnabled ? $t('common.enabled') : $t('common.disabled')}
</span>
</p>
{#if totpEnabled || totpLink}
{#if totpLink && !totpEnabled}
<TextInput disabled type="password" value={totpLink} label="TOTP Link">
<TextInput
disabled
type="password"
value={totpLink}
label={$t('form.profile.2fa.totp')}
>
<button
slot="suffix"
class="contents"
@@ -138,7 +145,7 @@
<Icon src={ClipboardDocument} size="20" mini />
</button>
<span class="font-normal text-xs">
Paste this in your authenticator app.
{$t('form.profile.2fa.paste')}
</span>
</TextInput>
{/if}
@@ -146,21 +153,21 @@
<TextInput
bind:value={verify_totp}
placeholder="012345"
label="2FA Code"
label={$t('form.2fa')}
/>
{#if totpEnabled}
<Button on:click={() => twofa(false, true)} size="lg" color="primary">
Disable
{$t('common.disabled')}
</Button>
{:else}
<Button on:click={() => twofa(true, true)} size="lg" color="primary">
Enable
{$t('common.enabled')}
</Button>
{/if}
</form>
{:else}
<Button on:click={() => twofa(true)} size="lg" color="primary">
Setup
{$t('form.setup')}
</Button>
{/if}
</div>