From 66d3fcf2e22f057bacce8d97d43a13c1c5a9ad09 Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Tue, 29 Oct 2024 23:29:22 -0400 Subject: Add `change password` UI + API. The protocol here re-checks the caller's password, as a "I left myself logged in" anti-pranking check. --- ui/lib/apiServer.js | 4 ++++ ui/lib/components/CurrentUser.svelte | 26 +++++++++++++++++++++++ ui/lib/components/LogOut.svelte | 26 ----------------------- ui/routes/(app)/+layout.svelte | 4 ---- ui/routes/(app)/me/+page.svelte | 41 ++++++++++++++++++++++++++++++++++++ ui/routes/+layout.svelte | 8 +++---- 6 files changed, 74 insertions(+), 35 deletions(-) create mode 100644 ui/lib/components/CurrentUser.svelte delete mode 100644 ui/lib/components/LogOut.svelte create mode 100644 ui/routes/(app)/me/+page.svelte (limited to 'ui') diff --git a/ui/lib/apiServer.js b/ui/lib/apiServer.js index db554e2..19dcf60 100644 --- a/ui/lib/apiServer.js +++ b/ui/lib/apiServer.js @@ -30,6 +30,10 @@ export async function logOut() { return apiServer.post('/auth/logout', {}); } +export async function changePassword(password, to) { + return apiServer.post('/password', { password, to }); +} + export async function createChannel(name) { return apiServer.post('/channels', { name }); } diff --git a/ui/lib/components/CurrentUser.svelte b/ui/lib/components/CurrentUser.svelte new file mode 100644 index 0000000..4b1b974 --- /dev/null +++ b/ui/lib/components/CurrentUser.svelte @@ -0,0 +1,26 @@ + + +
+ {#if $currentUser} + @{$currentUser.username} + {/if} + +
+ + diff --git a/ui/lib/components/LogOut.svelte b/ui/lib/components/LogOut.svelte deleted file mode 100644 index ba0861a..0000000 --- a/ui/lib/components/LogOut.svelte +++ /dev/null @@ -1,26 +0,0 @@ - - -
- {#if $currentUser} - @{$currentUser.username} - {/if} - -
- - diff --git a/ui/routes/(app)/+layout.svelte b/ui/routes/(app)/+layout.svelte index 9abaaf4..08c6694 100644 --- a/ui/routes/(app)/+layout.svelte +++ b/ui/routes/(app)/+layout.svelte @@ -86,8 +86,4 @@ max-height: 100%; overflow: scroll; } - #interface .active-channel { - border: 1px solid grey; - border-radius: 1.25rem; - } diff --git a/ui/routes/(app)/me/+page.svelte b/ui/routes/(app)/me/+page.svelte new file mode 100644 index 0000000..fb612b8 --- /dev/null +++ b/ui/routes/(app)/me/+page.svelte @@ -0,0 +1,41 @@ + + +
+ + + + + + + +
+ + diff --git a/ui/routes/+layout.svelte b/ui/routes/+layout.svelte index fdd3883..711b8bd 100644 --- a/ui/routes/+layout.svelte +++ b/ui/routes/+layout.svelte @@ -3,18 +3,16 @@ import "../app.css"; import { currentUser } from '$lib/store'; - import LogOut from '$lib/components/LogOut.svelte'; - import Invite from '$lib/components/Invite.svelte'; + import CurrentUser from '$lib/components/CurrentUser.svelte';
🌳 - understory + understory {#if $currentUser} - - + {/if} -- cgit v1.2.3 From cdb40ca671a85704f751179d13277a7db816b569 Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Tue, 29 Oct 2024 23:53:23 -0400 Subject: Incrementally less jank invite listing. --- ui/lib/components/Invite.svelte | 41 +++++++--------------------------------- ui/lib/components/Invites.svelte | 28 +++++++++++++++++++++++++++ ui/routes/(app)/me/+page.svelte | 4 ++-- 3 files changed, 37 insertions(+), 36 deletions(-) create mode 100644 ui/lib/components/Invites.svelte (limited to 'ui') diff --git a/ui/lib/components/Invite.svelte b/ui/lib/components/Invite.svelte index f4babad..7fdc753 100644 --- a/ui/lib/components/Invite.svelte +++ b/ui/lib/components/Invite.svelte @@ -1,40 +1,13 @@ - async function onSubmit() { - let response = await createInvite(); - if (response.status == 200) { - invite = response.data; - } - console.log("base url", base); - } + +{inviteUrl} - async function onReset() { - invite = null; - } - -
- {#if inviteUrl} - - {:else} - - {/if} -
diff --git a/ui/lib/components/Invites.svelte b/ui/lib/components/Invites.svelte new file mode 100644 index 0000000..df51afb --- /dev/null +++ b/ui/lib/components/Invites.svelte @@ -0,0 +1,28 @@ + + +
    + {#each $invites as invite} +
  • + {/each} +
+
+ +
diff --git a/ui/routes/(app)/me/+page.svelte b/ui/routes/(app)/me/+page.svelte index fb612b8..7559dbe 100644 --- a/ui/routes/(app)/me/+page.svelte +++ b/ui/routes/(app)/me/+page.svelte @@ -1,7 +1,7 @@