From 515e9c6b0492587781956e702309de8392ff940b Mon Sep 17 00:00:00 2001 From: Mathias Magnusson Date: Wed, 13 Nov 2024 16:04:39 +0100 Subject: [PATCH] automatically focus passkey button if pre-filling username --- templates/passkey.templ | 3 ++- templates/passkey_templ.go | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/templates/passkey.templ b/templates/passkey.templ index 0b5bd88..3b6f252 100644 --- a/templates/passkey.templ +++ b/templates/passkey.templ @@ -10,7 +10,7 @@ templ PasskeyLoginForm(kthid string, credAss *protocol.CredentialAssertion) { id="passkey-login-form" hx-post="/login/passkey/begin" _=" - on load if localStorage.logout_saved_kthid then set #pk-kthid.value to localStorage.logout_saved_kthid end + on load if localStorage.logout_saved_kthid then set #pk-kthid.value to localStorage.logout_saved_kthid then call #pk-init.focus() end on submit remove <.error/> then if #pk-kthid.value then set localStorage.logout_saved_kthid to #pk-kthid.value " if credAss != nil { @@ -81,6 +81,7 @@ templ PasskeyLoginForm(kthid string, credAss *protocol.CredentialAssertion) { " />