Skip to content

Commit cabcca3

Browse files
authored
Run detectWebAuthnSupport only if necessary (#31691)
Follow #31676, which is not correct, see #31676 (comment) Fix #31675, regression of #31504.
1 parent ecc8f2b commit cabcca3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

web_src/js/features/user-auth-webauthn.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ import {GET, POST} from '../modules/fetch.ts';
55
const {appSubUrl} = window.config;
66

77
export async function initUserAuthWebAuthn() {
8-
if (!document.querySelector('.user.signin')) {
8+
const elPrompt = document.querySelector('.user.signin.webauthn-prompt');
9+
const elSignInPasskeyBtn = document.querySelector('.signin-passkey');
10+
if (!elPrompt && !elSignInPasskeyBtn) {
911
return;
1012
}
1113

1214
if (!detectWebAuthnSupport()) {
1315
return;
1416
}
1517

16-
const elSignInPasskeyBtn = document.querySelector('.signin-passkey');
1718
if (elSignInPasskeyBtn) {
1819
elSignInPasskeyBtn.addEventListener('click', loginPasskey);
1920
}
2021

21-
const elPrompt = document.querySelector('.user.signin.webauthn-prompt');
2222
if (elPrompt) {
2323
login2FA();
2424
}

0 commit comments

Comments
 (0)