passwordless login + proper migrations
ci/woodpecker/push/e2e Pipeline was successful
ci/woodpecker/push/fmt Pipeline was successful
ci/woodpecker/push/test Pipeline was successful

This commit is contained in:
2026-08-03 00:23:10 -04:00
parent 1291c5a33a
commit 209363774c
14 changed files with 753 additions and 188 deletions
+6 -10
View File
@@ -6,31 +6,27 @@ function b64ToBytes(b64) {
}
document.getElementById("passkey-login").addEventListener("click", async () => {
const email = document.getElementById("email").value;
if (!email) {
alert("Enter your email first.");
return;
}
const email = document.getElementById("email").value.trim();
const start = await fetch("/auth/passkey/login/start", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ email }),
});
if (!start.ok) {
alert("No passkey found for that email.");
alert("No passkey found for that account.");
return;
}
const options = await start.json();
const pk = options.publicKey;
const data = await start.json();
const pk = data.publicKey;
pk.challenge = b64ToBytes(pk.challenge);
if (pk.allowCredentials) {
pk.allowCredentials.forEach((c) => (c.id = b64ToBytes(c.id)));
}
const credential = await navigator.credentials.get(options);
const credential = await navigator.credentials.get({ publicKey: pk });
const finish = await fetch("/auth/passkey/login/finish", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ response: credential }),
body: JSON.stringify({ token: data.token, response: credential }),
});
if (finish.ok) {
window.location.href = "/lists";