diff --git a/.vscode/settings.json b/.vscode/settings.json index 80257b1..98d42be 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -28,7 +28,7 @@ ], "cssvar.enable": true, "cssvar.files": ["./_fresh/*"], - "conventionalCommits.scopes": ["css", "config", "ui", "pwa", "api"], + "conventionalCommits.scopes": ["css", "config", "ui", "pwa", "api", "ux"], "[ignore]": { "editor.defaultFormatter": "foxundermoon.shell-format" } diff --git a/islands/LoginForm.tsx b/islands/LoginForm.tsx index 207b104..f1ec6a2 100644 --- a/islands/LoginForm.tsx +++ b/islands/LoginForm.tsx @@ -9,7 +9,12 @@ import { requestApi } from '../src/utils.ts' export default function LoginForm() { return ( -
+ - + +
) } type LoginFormFields = { email: string + passkey: boolean } async function connect(event: Event) { @@ -33,6 +45,11 @@ async function connect(event: Event) { const fields = formJSON(form) try { + // User disable passkey + if (!fields.passkey) { + throw new Error('User refused passkey') + } + // Try PassKey connection if (!isWebAuthnSupported()) { throw new Error('WebAuthn is not supported by your browser') @@ -77,7 +94,7 @@ async function webAuthnLogin(fields: LoginFormFields) { const verification = await requestApi< WebAuthnLoginFinishPayload, { verified: boolean } - >('webauthn/login/finish', 'POST', { ...fields, authentication }) + >('webauthn/login/finish', 'POST', authentication) // Show UI appropriate for the `verified` status if (verification.verified) {