From bbd14769cd0314ed6618462e6e43c859a5ef1959 Mon Sep 17 00:00:00 2001
From: Jason Song <i@wolfogre.com>
Date: Wed, 24 Jul 2024 01:52:40 +0800
Subject: [PATCH] Run `detectWebAuthnSupport` only on sign-in page (#31676)

Fix #31675, regression of #31504.
---
 web_src/js/features/user-auth-webauthn.ts | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/web_src/js/features/user-auth-webauthn.ts b/web_src/js/features/user-auth-webauthn.ts
index 7b7508c4f1..35c6aa8f7c 100644
--- a/web_src/js/features/user-auth-webauthn.ts
+++ b/web_src/js/features/user-auth-webauthn.ts
@@ -5,6 +5,10 @@ import {GET, POST} from '../modules/fetch.ts';
 const {appSubUrl} = window.config;
 
 export async function initUserAuthWebAuthn() {
+  if (!document.querySelector('.user.signin')) {
+    return;
+  }
+
   if (!detectWebAuthnSupport()) {
     return;
   }