Disable "Start enrollment" button while processing credentials

This commit is contained in:
Pierre HUBERT 2022-04-21 19:31:38 +02:00
parent 0f17a8a35c
commit f09a62f8df

View File

@ -15,7 +15,7 @@
</div>
<input type="button" class="btn btn-primary" value="Start enrollment" onclick="startEnrollment()"
style="margin-top: 20px;"/>
style="margin-top: 20px;" id="submitButton" />
<script src="/assets/js/base64_lib.js"></script>
<script>
@ -30,8 +30,10 @@
REGISTRATION_CHALLENGE.publicKey.user.id
);
const submitButton = document.getElementById("submitButton");
async function startEnrollment() {
submitButton.disabled = true;
try {
const factorNameInput = document.getElementById("inputKeyName");
factorNameInput.classList.remove("is-invalid");
@ -77,6 +79,8 @@
} catch(e) {
console.error(e);
alert("Failed enrollment, please try again!");
} finally {
submitButton.disabled = false;
}
}
</script>