Skip to content

Commit

Permalink
Passkeys funktionierten in Chrome nicht (#5625)
Browse files Browse the repository at this point in the history
  • Loading branch information
gharlan committed Mar 7, 2023
1 parent 23ba727 commit 5066bbd
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions redaxo/src/core/assets/webauthn.js
Expand Up @@ -114,6 +114,12 @@ const arrayBufferToBase64 = function (buffer) {
if (window.PublicKeyCredential &&
PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable &&
PublicKeyCredential.isConditionalMediationAvailable) {

let ready = false;
$(document).on('rex:ready', function () {
ready = true;
});

// Check if user verifying platform authenticator is available.
Promise.all([
PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable(),
Expand All @@ -123,9 +129,7 @@ if (window.PublicKeyCredential &&
return;
}

$(document).on('rex:ready', function (event, container) {
container = container.get(0);

const init = function (container) {
let form = container.querySelector('form[data-auth-add-passkey]');
if (form) {
authAddPasskey(form);
Expand All @@ -140,6 +144,14 @@ if (window.PublicKeyCredential &&
if (form) {
authLogin(form);
}
}

if (ready) {
init(document.body);
}

$(document).on('rex:ready', function (event, container) {
init(container.get(0));
});
});
}

0 comments on commit 5066bbd

Please sign in to comment.