diff options
| author | Adam Soltys <[email protected]> | 2026-02-26 16:07:52 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-02-26 16:07:52 -0800 |
| commit | 18df062a099811355cafc2024e30a7c2b68c7984 (patch) | |
| tree | 1de4c341b3111f7ccc6c0e74824b2bc6115d3401 /src/routes/(app) | |
| parent | 2a59047dc8fc10560a7fde614238ee821cfb6b1b (diff) | |
| download | coinos-ui-18df062a099811355cafc2024e30a7c2b68c7984.tar.gz coinos-ui-18df062a099811355cafc2024e30a7c2b68c7984.zip | |
client side password auth
Diffstat (limited to 'src/routes/(app)')
| -rw-r--r-- | src/routes/(app)/settings/+layout.svelte | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/routes/(app)/settings/+layout.svelte b/src/routes/(app)/settings/+layout.svelte index 2090bd3a..ce45f915 100644 --- a/src/routes/(app)/settings/+layout.svelte +++ b/src/routes/(app)/settings/+layout.svelte @@ -201,6 +201,19 @@ } } + // If password is changing, derive new authPubkey + const pw = body.get("password") as string; + const un = (body.get("username") as string) || user.username; + if (pw && pw === body.get("confirm")) { + try { + const { deriveAuthKeypair } = await import("$lib/deriveAuthKey"); + const { pubkey: authPubkey } = await deriveAuthKeypair(un, pw); + body.set("authPubkey", authPubkey); + } catch (e) { + console.log("Failed to derive authPubkey for password change", e); + } + } + const response = await fetch(formElement!.action, { method: "POST", body, @@ -210,7 +223,7 @@ if (result.type === "success") { await invalidateAll(); - if (body.get("password")) $password = body.get("password") as string; + if (pw) $password = pw; } applyAction(result); |
