diff options
| author | Kit La Touche <kit@transneptune.net> | 2024-10-30 16:50:06 -0400 |
|---|---|---|
| committer | Kit La Touche <kit@transneptune.net> | 2024-10-30 16:50:06 -0400 |
| commit | 113096a2cca42008c0a19110abe322180dbdf66b (patch) | |
| tree | cb871dae060e60be7fd2114ee4741027ae38bd78 /ui/routes/(app) | |
| parent | 610f6839d2e449d172aa6ac35e6c1de0677a0754 (diff) | |
| parent | 06c839436900ce07ec5c53175b01f3c5011e507c (diff) | |
Merge branch 'main' into wip/mobile
Diffstat (limited to 'ui/routes/(app)')
| -rw-r--r-- | ui/routes/(app)/me/+page.svelte | 41 |
1 files changed, 41 insertions, 0 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 /> |
