Skip to content

Commit 822ee60

Browse files
a1012112796lunny
andauthored
fix webAuthn insecure error view (go-gitea#36165)
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 go-gitea#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 <[email protected]> Co-authored-by: Lunny Xiao <[email protected]>
1 parent da08727 commit 822ee60

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,8 @@ export async function initUserAuthWebAuthn() {
1111
return;
1212
}
1313

14-
// webauthn is only supported on secure contexts
15-
if (!window.isSecureContext) {
16-
if (elSignInPasskeyBtn) hideElem(elSignInPasskeyBtn);
17-
return;
18-
}
19-
2014
if (!detectWebAuthnSupport()) {
15+
if (elSignInPasskeyBtn) hideElem(elSignInPasskeyBtn);
2116
return;
2217
}
2318

0 commit comments

Comments
 (0)