From 822ee60baea681f13f2d23bb9607ea679b0f779d Mon Sep 17 00:00:00 2001 From: a1012112796 <1012112796@qq.com> Date: Tue, 16 Dec 2025 04:03:52 +0800 Subject: [PATCH] fix webAuthn insecure error view (#36165) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit as you seen, in cureent status `initUserAuthWebAuthn` will prcheck `window.isSecureContext`, if not ok, will hide the `passkey` btton and return directly. I think it's not right, first, not show any error message looks not a good ui, and it's looks will make an empty container was show if the registion button was disabled also (maybe f-i-x #36115), then initUserAuthWebAuthn has `window.isSecureContext` check also which looks duplcate ref: https://github.com/go-gitea/gitea/blob/26602fd2070886a1e7e0545f11f5541a38396003/web_src/js/features/user-auth-webauthn.ts#L202-L206 so I'd like move hideElem(elSignInPasskeyBtn); to `detectWebAuthnSupport` failed routs to make it simple and show insecure error corectly. ![联想截图_20251215184757](https://github.com/user-attachments/assets/0eff43a0-18a6-4978-aa27-b4574fcf2601) Signed-off-by: a1012112796 <1012112796@qq.com> Co-authored-by: Lunny Xiao --- web_src/js/features/user-auth-webauthn.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/web_src/js/features/user-auth-webauthn.ts b/web_src/js/features/user-auth-webauthn.ts index 50165c3377..6de84e94e0 100644 --- a/web_src/js/features/user-auth-webauthn.ts +++ b/web_src/js/features/user-auth-webauthn.ts @@ -11,13 +11,8 @@ export async function initUserAuthWebAuthn() { return; } - // webauthn is only supported on secure contexts - if (!window.isSecureContext) { - if (elSignInPasskeyBtn) hideElem(elSignInPasskeyBtn); - return; - } - if (!detectWebAuthnSupport()) { + if (elSignInPasskeyBtn) hideElem(elSignInPasskeyBtn); return; }