Browse Source

fix webAuthn insecure error view (#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 #36115),
then initUserAuthWebAuthn has `window.isSecureContext` check also which
looks duplcate ref:

26602fd207/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 <xiaolunwen@gmail.com>
pull/36105/merge
a1012112796 2 days ago committed by GitHub
parent
commit
822ee60bae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 7
      web_src/js/features/user-auth-webauthn.ts

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

@ -11,13 +11,8 @@ export async function initUserAuthWebAuthn() {
return; return;
} }
// webauthn is only supported on secure contexts
if (!window.isSecureContext) {
if (elSignInPasskeyBtn) hideElem(elSignInPasskeyBtn);
return;
}
if (!detectWebAuthnSupport()) { if (!detectWebAuthnSupport()) {
if (elSignInPasskeyBtn) hideElem(elSignInPasskeyBtn);
return; return;
} }

Loading…
Cancel
Save