aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(static)
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-02-28 22:06:27 -0800
committerAdam Soltys <[email protected]>2026-02-28 22:06:27 -0800
commit6ca9170a25b253483e7ce15767b7daae67c1334f (patch)
tree38be88205312e504630dc84c5ab0223a4f7cff6a /src/routes/(static)
parent36ae7b0cfc66aa614287f96ac2be85ff183130a2 (diff)
downloadcoinos-ui-6ca9170a25b253483e7ce15767b7daae67c1334f.tar.gz
coinos-ui-6ca9170a25b253483e7ce15767b7daae67c1334f.zip
ark wait for send
Diffstat (limited to 'src/routes/(static)')
-rw-r--r--src/routes/(static)/login/+page.server.ts2
-rw-r--r--src/routes/(static)/login/+page.svelte26
2 files changed, 26 insertions, 2 deletions
diff --git a/src/routes/(static)/login/+page.server.ts b/src/routes/(static)/login/+page.server.ts
index 68143d83..0c493422 100644
--- a/src/routes/(static)/login/+page.server.ts
+++ b/src/routes/(static)/login/+page.server.ts
@@ -66,7 +66,7 @@ export const actions = {
if (res.status === 401) {
if (text.startsWith("2fa")) throw new Error("2fa");
- throw new Error(text);
+ return fail(400, { error: "Login failed" });
}
if (!res.ok) {
diff --git a/src/routes/(static)/login/+page.svelte b/src/routes/(static)/login/+page.svelte
index c23acc8b..20b56134 100644
--- a/src/routes/(static)/login/+page.svelte
+++ b/src/routes/(static)/login/+page.svelte
@@ -161,7 +161,31 @@
await invalidateAll();
goto(result.data?.redirectUrl || `/${uname}`);
} else {
- applyAction(result);
+ // Challenge-response failed — fall back to password-based login
+ console.log("Auth key login failed, falling back to password login");
+ formData.set("authPubkey", pubkey);
+ const fallbackRes = await fetch("/login?/login", {
+ method: "POST",
+ body: formData,
+ });
+ const fallbackResult: any = deserialize(await fallbackRes.text());
+ if (fallbackResult.type === "success") {
+ try {
+ const oldPrfKey = await deriveWalletEntropy(sk);
+ await resolveCanonicalKey(
+ passwordMethodId(),
+ sk.buffer as ArrayBuffer,
+ fallbackResult.data?.encryptedKeys,
+ oldPrfKey,
+ );
+ } catch (e) {
+ console.log("Canonical key resolution failed", e);
+ }
+ await invalidateAll();
+ goto(fallbackResult.data?.redirectUrl || `/${uname}`);
+ } else {
+ applyAction(fallbackResult);
+ }
}
return;
}