- 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
39 lines
1.1 KiB
JavaScript
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(() => {});
|
|
}
|