auth-yes/public/webauthn-login.js
Tyler Gillispie 8b30b17dbe
feat(arch): implement Phase 2 base vertical slices and shared UI (#57)
- Scaffold shared UI fragments and styles in src/shared/ui/
- Implement full Auth vertical slice in src/features/auth/ with WebAuthn ceremonies and recovery endpoints
- Implement full Admin vertical slice in src/features/admin/ with responsive tables and mobile decks
- Add public client-side JS utilities and pure JS BIP-39 module
- Mount routes in src/main.ts and keep legacy server/ and ui/ quarantined
- Add pure JSX and API tests for Auth and Admin slices
2026-08-27 19:29:08 -07:00

39 lines
1.1 KiB
JavaScript

const btn = document.getElementById("loginBtn");
const loader = document.getElementById("loadingIndicator");
const status = document.getElementById("statusMessage");
if (btn) {
btn.addEventListener("click", async () => {
loader.style.display = "block";
btn.disabled = true;
status.textContent = "";
status.className = "";
try {
const username =
document.getElementById("loginUsername")?.value?.trim() || "";
await startWebAuthnLogin(username);
} catch (_e) {
// handled in auth-client.js
} finally {
loader.style.display = "none";
btn.disabled = false;
}
});
}
// Initialize WebAuthn Conditional UI (Autofill) if supported
if (
globalThis.PublicKeyCredential &&
PublicKeyCredential.isConditionalMediationAvailable
) {
PublicKeyCredential.isConditionalMediationAvailable().then((available) => {
if (available) {
console.log("[WebAuthn] Conditional mediation autofill available");
if (typeof startWebAuthnConditionalLogin === "function") {
startWebAuthnConditionalLogin();
}
}
}).catch(() => {});
}