diff --git a/bun.lockb b/bun.lockb index 671aff54..ba3ab499 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index e3ab664e..9bafa498 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "@tailwindcss/container-queries": "^0.1.1", "@tanstack/svelte-virtual": "^3.8.1", "@types/nprogress": "^0.2.0", + "@types/ua-parser-js": "^0.7.39", "autoprefixer": "^10.4.16", "jsdom": "^22.1.0", "lemmy-js-client": "latest", @@ -32,6 +33,7 @@ "tailwindcss": "^3.3.3", "tslib": "^2.4.1", "typescript": "^5.0.0", + "ua-parser-js": "^1.0.38", "vite": "^5.0.0", "vitest": "^1.0.0" }, diff --git a/src/lib/components/ui/EntityHeader.svelte b/src/lib/components/ui/EntityHeader.svelte index 61b5b1f0..c6b62708 100644 --- a/src/lib/components/ui/EntityHeader.svelte +++ b/src/lib/components/ui/EntityHeader.svelte @@ -14,7 +14,7 @@ }[] = [] - + {#if banner}
- + {name}

{#if icon} diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.json index 05aee9b5..2a0799fb 100644 --- a/src/lib/i18n/en.json +++ b/src/lib/i18n/en.json @@ -197,7 +197,7 @@ "user": "User", "settings": "Settings", "blocks": "Blocks", - "credentials": "Credentials", + "credentials": "Account", "moderates": "Moderating", "favorites": "Favorites", "upvoted": "Upvoted", @@ -205,6 +205,12 @@ "media": { "title": "Media", "download": "Download" + }, + "logins": "Logins", + "welcome": "Welcome, {{default}}!", + "delete": { + "title": "Delete account", + "warning": "This is permanent. Are you sure you want to do this?" } }, "translators": "Translators", @@ -532,7 +538,8 @@ "disable": "Disable", "add": "Add", "cancel": "Cancel", - "send": "Send" + "send": "Send", + "general": "General" }, "message": { "success": "Success", diff --git a/src/routes/profile/(local_user)/password/+layout.svelte b/src/routes/profile/(local_user)/password/+layout.svelte new file mode 100644 index 00000000..f2c2c350 --- /dev/null +++ b/src/routes/profile/(local_user)/password/+layout.svelte @@ -0,0 +1,52 @@ + + +
+ {routes.find((r) => $page.url.pathname == r.url)?.name} +
+
+ +
+ +
+
diff --git a/src/routes/profile/(local_user)/password/+page.svelte b/src/routes/profile/(local_user)/password/+page.svelte index 49dda70b..505d1880 100644 --- a/src/routes/profile/(local_user)/password/+page.svelte +++ b/src/routes/profile/(local_user)/password/+page.svelte @@ -1,178 +1,103 @@ -
{$t('routes.profile.credentials')}
- diff --git a/src/routes/profile/(local_user)/password/2fa/+page.svelte b/src/routes/profile/(local_user)/password/2fa/+page.svelte new file mode 100644 index 00000000..874dace7 --- /dev/null +++ b/src/routes/profile/(local_user)/password/2fa/+page.svelte @@ -0,0 +1,102 @@ + + +
+

+ + {totpEnabled ? $t('common.enabled') : $t('common.disabled')} + +

+ {#if totpEnabled || totpLink} + {#if totpLink && !totpEnabled} + + + + + + + {$t('form.profile.2fa.paste')} + + + {/if} +
{}} + > + + {#if totpEnabled} + + {:else} + + {/if} + + {:else} + + {/if} +
diff --git a/src/routes/profile/(local_user)/password/change/+page.svelte b/src/routes/profile/(local_user)/password/change/+page.svelte new file mode 100644 index 00000000..caf2b08a --- /dev/null +++ b/src/routes/profile/(local_user)/password/change/+page.svelte @@ -0,0 +1,77 @@ + + +
+ + + + + diff --git a/src/routes/profile/(local_user)/password/delete/+page.svelte b/src/routes/profile/(local_user)/password/delete/+page.svelte new file mode 100644 index 00000000..bfe317cf --- /dev/null +++ b/src/routes/profile/(local_user)/password/delete/+page.svelte @@ -0,0 +1,140 @@ + + +{#if deletion.modal} + deleteAccount(4)} + > + {$t('form.profile.deleteAccount.label')} + + + {$t('form.profile.deleteAccount.deleteContent')} + + {$t('form.profile.deleteAccount.warning')} + + + +{/if} + + +
+ {$t('routes.profile.delete.title')} +
+

+ {$t('routes.profile.delete.warning')} +

+ + {$t('form.profile.deleteAccount.deleteContent')} + + {$t('form.profile.deleteAccount.warning')} + + + +
diff --git a/src/routes/profile/(local_user)/password/logins/+page.svelte b/src/routes/profile/(local_user)/password/logins/+page.svelte new file mode 100644 index 00000000..7d4dc730 --- /dev/null +++ b/src/routes/profile/(local_user)/password/logins/+page.svelte @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + {#each data.tokens as token} + {@const ua = new UAParser(token.user_agent).getResult()} + + + + + + + + + + {/each} + +
User AgentIPDate
+ + +
{ua.os.name} {ua.os.version}
+
{ua.browser.name}
+
+ {token.ip} + + +
+
diff --git a/src/routes/profile/(local_user)/password/logins/+page.ts b/src/routes/profile/(local_user)/password/logins/+page.ts new file mode 100644 index 00000000..bb97d8c1 --- /dev/null +++ b/src/routes/profile/(local_user)/password/logins/+page.ts @@ -0,0 +1,11 @@ +import { client } from '$lib/lemmy.js' + +export async function load({ fetch, parent }) { + const user = await parent() + + const response = await client({ func: fetch }).listLogins() + + return { + tokens: response, + } +} diff --git a/src/routes/profile/(local_user)/settings/+page.svelte b/src/routes/profile/(local_user)/settings/+page.svelte index 7997ff13..65622c7d 100644 --- a/src/routes/profile/(local_user)/settings/+page.svelte +++ b/src/routes/profile/(local_user)/settings/+page.svelte @@ -1,5 +1,4 @@ -{#if deletion.modal} - deleteAccount(4)} - > - {$t('form.profile.deleteAccount.label')} - - - {$t('form.profile.deleteAccount.deleteContent')} - - {$t('form.profile.deleteAccount.warning')} - - - -{/if} -
{$t('routes.profile.settings')}
{#if data.my_user?.local_user_view?.local_user && formData} @@ -206,12 +104,4 @@ {$t('common.save')} {/if} -
diff --git a/tailwind.config.js b/tailwind.config.js index cb0b044c..e78c4289 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -15,6 +15,7 @@ export default { inter: ['Inter', 'system-ui', 'sans-serif'], nunito: ['Nunito', 'system-ui', 'sans-serif'], display: ['Satoshi', 'system-ui', 'sans-serif'], + mono: ['monospace'], }, extend: { animation: {