summaryrefslogtreecommitdiff
path: root/ui/routes
diff options
context:
space:
mode:
authorKit La Touche <kit@transneptune.net>2024-10-30 16:50:06 -0400
committerKit La Touche <kit@transneptune.net>2024-10-30 16:50:06 -0400
commit113096a2cca42008c0a19110abe322180dbdf66b (patch)
treecb871dae060e60be7fd2114ee4741027ae38bd78 /ui/routes
parent610f6839d2e449d172aa6ac35e6c1de0677a0754 (diff)
parent06c839436900ce07ec5c53175b01f3c5011e507c (diff)
Merge branch 'main' into wip/mobile
Diffstat (limited to 'ui/routes')
-rw-r--r--ui/routes/(app)/me/+page.svelte41
-rw-r--r--ui/routes/+layout.svelte7
2 files changed, 45 insertions, 3 deletions
diff --git a/ui/routes/(app)/me/+page.svelte b/ui/routes/(app)/me/+page.svelte
new file mode 100644
index 0000000..7559dbe
--- /dev/null
+++ b/ui/routes/(app)/me/+page.svelte
@@ -0,0 +1,41 @@
+<script>
+ import { changePassword } from '$lib/apiServer.js';
+
+ import Invites from '$lib/components/Invites.svelte';
+
+ let currentPassword, newPassword, confirmPassword, passwordForm;
+ let pending = false;
+ $: valid = (newPassword === confirmPassword) && (newPassword !== currentPassword);
+ $: disabled = pending || !valid;
+
+ async function onPasswordChange() {
+ pending = true;
+ let response = await changePassword(currentPassword, newPassword);
+ switch (response.status) {
+ case 200:
+ passwordForm.reset();
+ break;
+ }
+ pending = false;
+ }
+</script>
+
+<form on:submit|preventDefault={onPasswordChange} bind:this={passwordForm} >
+ <label>current password
+ <input class="input" name="currentPassword" type="password" placeholder="password" bind:value={currentPassword}>
+ </label>
+
+ <label>new password
+ <input class="input" name="newPassword" type="password" placeholder="password" bind:value={newPassword}>
+ </label>
+
+ <label>confirm new password
+ <input class="input" name="confirmPassword" type="password" placeholder="password" bind:value={confirmPassword}>
+ </label>
+
+ <button class="btn variant-filled" type="submit" disabled={disabled}>
+ change password
+ </button>
+</form>
+
+<Invites />
diff --git a/ui/routes/+layout.svelte b/ui/routes/+layout.svelte
index b7ed746..4133ff3 100644
--- a/ui/routes/+layout.svelte
+++ b/ui/routes/+layout.svelte
@@ -1,12 +1,13 @@
<script>
- import { AppBar } from '@skeletonlabs/skeleton';
import "../app.css";
-
import logo from '$lib/assets/logo.png';
+ import { AppBar } from '@skeletonlabs/skeleton';
import { showMenu, currentUser } from '$lib/store';
- import LogOut from '$lib/components/LogOut.svelte';
+
+ import CurrentUser from '$lib/components/CurrentUser.svelte';
import Invite from '$lib/components/Invite.svelte';
+ import LogOut from '$lib/components/LogOut.svelte';
function toggleMenu() {
showMenu.update((value) => !value);