aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/routes/(app)/[username]/(profile)/+layout.svelte2
-rw-r--r--src/routes/(app)/reset/+server.ts7
2 files changed, 8 insertions, 1 deletions
diff --git a/src/routes/(app)/[username]/(profile)/+layout.svelte b/src/routes/(app)/[username]/(profile)/+layout.svelte
index c6dc6569..a5faa0af 100644
--- a/src/routes/(app)/[username]/(profile)/+layout.svelte
+++ b/src/routes/(app)/[username]/(profile)/+layout.svelte
@@ -63,7 +63,7 @@
let reset = async () => {
try {
- await post(`/${stripped}/reset`, { password });
+ await post(`/reset`, { username, password });
success("Password reset");
} catch (e) {
fail(e.message);
diff --git a/src/routes/(app)/reset/+server.ts b/src/routes/(app)/reset/+server.ts
new file mode 100644
index 00000000..544c4e0a
--- /dev/null
+++ b/src/routes/(app)/reset/+server.ts
@@ -0,0 +1,7 @@
+import { json } from "@sveltejs/kit";
+import { auth, post } from "$lib/utils";
+
+export async function POST({ cookies, request }) {
+ let result = await post("/reset", await request.json(), auth(cookies));
+ return json(result);
+}