Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passkeys funktionierten in Chrome nicht #5625

Merged
merged 2 commits into from
Mar 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 15 additions & 3 deletions redaxo/src/core/assets/webauthn.js
Original file line number Diff line number Diff line change
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));
});
});
}