Skip to content

Commit

Permalink
πŸ›πŸŽ¨ Feature-detect full Webauthn support
Browse files Browse the repository at this point in the history
  • Loading branch information
webknjaz committed Jul 26, 2019
1 parent 3e43e27 commit 5f52224
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions warehouse/static/js/warehouse/utils/webauthn.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,15 @@ const postAssertion = async (assertion, token) => {
return await resp.json();
};

export const GuardWebAuthn = () => {
if (!window.PublicKeyCredential) {
export const GuardWebAuthn = async () => {
if (
!window.PublicKeyCredential ||
!(
await window
.PublicKeyCredential
.isUserVerifyingPlatformAuthenticatorAvailable()
)
) {
let webauthn_button = document.getElementById("webauthn-button");
if (webauthn_button) {
webauthn_button.className += " button--disabled";
Expand Down

0 comments on commit 5f52224

Please sign in to comment.