diff options
author | Jason Song <i@wolfogre.com> | 2024-07-26 07:26:41 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-25 23:26:41 +0000 |
commit | cabcca3d818e1c7fdfd4ddf41e233f273b779481 (patch) | |
tree | 3fccc2cc0dc25863a971664791d5ad379ced7646 /web_src/js/features | |
parent | ecc8f2b047be405f39d81ae17280e478116845e3 (diff) | |
download | gitea-cabcca3d818e1c7fdfd4ddf41e233f273b779481.tar.gz gitea-cabcca3d818e1c7fdfd4ddf41e233f273b779481.zip |
Run `detectWebAuthnSupport` only if necessary (#31691)
Follow #31676, which is not correct, see
https://github.com/go-gitea/gitea/pull/31676#issuecomment-2246658217
Fix #31675, regression of #31504.
Diffstat (limited to 'web_src/js/features')
-rw-r--r-- | web_src/js/features/user-auth-webauthn.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/web_src/js/features/user-auth-webauthn.ts b/web_src/js/features/user-auth-webauthn.ts index 35c6aa8f7c..610b559833 100644 --- a/web_src/js/features/user-auth-webauthn.ts +++ b/web_src/js/features/user-auth-webauthn.ts @@ -5,7 +5,9 @@ import {GET, POST} from '../modules/fetch.ts'; const {appSubUrl} = window.config; export async function initUserAuthWebAuthn() { - if (!document.querySelector('.user.signin')) { + const elPrompt = document.querySelector('.user.signin.webauthn-prompt'); + const elSignInPasskeyBtn = document.querySelector('.signin-passkey'); + if (!elPrompt && !elSignInPasskeyBtn) { return; } @@ -13,12 +15,10 @@ export async function initUserAuthWebAuthn() { return; } - const elSignInPasskeyBtn = document.querySelector('.signin-passkey'); if (elSignInPasskeyBtn) { elSignInPasskeyBtn.addEventListener('click', loginPasskey); } - const elPrompt = document.querySelector('.user.signin.webauthn-prompt'); if (elPrompt) { login2FA(); } |