|
@ -11,22 +11,22 @@ $(function() { |
|
|
function requestCredentials() { |
|
|
function requestCredentials() { |
|
|
// Hide error & success messages, show the "waiting" message
|
|
|
// Hide error & success messages, show the "waiting" message
|
|
|
$("#name-next").addClass("hide"); |
|
|
$("#name-next").addClass("hide"); |
|
|
$("#add-credential-waiting").removeClass("hide"); |
|
|
|
|
|
$("#add-credential-error").addClass("hide"); |
|
|
|
|
|
$("#add-credential-success").addClass("hide"); |
|
|
|
|
|
|
|
|
$("#waiting").removeClass("hide"); |
|
|
|
|
|
$("#error").addClass("hide"); |
|
|
|
|
|
$("#success").addClass("hide"); |
|
|
|
|
|
|
|
|
navigator.credentials.create(options).then(function(attestation) { |
|
|
navigator.credentials.create(options).then(function(attestation) { |
|
|
$("#attestation_object").val(b64(attestation.response.attestationObject)); |
|
|
$("#attestation_object").val(b64(attestation.response.attestationObject)); |
|
|
$("#client_data_json").val(b64(attestation.response.clientDataJSON)); |
|
|
$("#client_data_json").val(b64(attestation.response.clientDataJSON)); |
|
|
|
|
|
|
|
|
// Show the success message and save button
|
|
|
// Show the success message and save button
|
|
|
$("#add-credential-waiting").addClass("hide"); |
|
|
|
|
|
$("#add-credential-success").removeClass("hide"); |
|
|
|
|
|
|
|
|
$("#waiting").addClass("hide"); |
|
|
|
|
|
$("#success").removeClass("hide"); |
|
|
}).catch(function(err) { |
|
|
}).catch(function(err) { |
|
|
// Show the error message
|
|
|
// Show the error message
|
|
|
$("#add-credential-waiting").addClass("hide"); |
|
|
|
|
|
$("#add-credential-error-text").text(err); |
|
|
|
|
|
$("#add-credential-error").removeClass("hide"); |
|
|
|
|
|
|
|
|
$("#waiting").addClass("hide"); |
|
|
|
|
|
$("#error-text").text(err); |
|
|
|
|
|
$("#error").removeClass("hide"); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|