diff --git a/two_factor/plugins/webauthn/templates/two_factor_webauthn/create_credential.js b/two_factor/plugins/webauthn/templates/two_factor_webauthn/create_credential.js index 4acb5c7e8..3c03e997f 100644 --- a/two_factor/plugins/webauthn/templates/two_factor_webauthn/create_credential.js +++ b/two_factor/plugins/webauthn/templates/two_factor_webauthn/create_credential.js @@ -20,7 +20,7 @@ navigator.credentials.create({ type: attestationCredential.type, }, tokenField = document.querySelector('[name=webauthn-token]'), - form = document.forms[0]; + form = tokenField.closest('form'); tokenField.value = JSON.stringify(serializableAttestationCredential); form.submit();