1
1
mirror of https://github.com/go-gitea/gitea synced 2024-11-10 20:24:24 +00:00

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.
This commit is contained in:
Jason Song 2024-07-26 07:26:41 +08:00 committed by GitHub
parent ecc8f2b047
commit cabcca3d81
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,7 +5,9 @@ import {GET, POST} from '../modules/fetch.ts';
const {appSubUrl} = window.config; const {appSubUrl} = window.config;
export async function initUserAuthWebAuthn() { 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; return;
} }
@ -13,12 +15,10 @@ export async function initUserAuthWebAuthn() {
return; return;
} }
const elSignInPasskeyBtn = document.querySelector('.signin-passkey');
if (elSignInPasskeyBtn) { if (elSignInPasskeyBtn) {
elSignInPasskeyBtn.addEventListener('click', loginPasskey); elSignInPasskeyBtn.addEventListener('click', loginPasskey);
} }
const elPrompt = document.querySelector('.user.signin.webauthn-prompt');
if (elPrompt) { if (elPrompt) {
login2FA(); login2FA();
} }