mirror of
https://github.com/discourse/discourse.git
synced 2024-12-15 12:43:42 +08:00
24 lines
664 B
Plaintext
24 lines
664 B
Plaintext
|
import { getWebauthnCredential } from "discourse/lib/webauthn";
|
||
|
|
||
|
document.getElementById("submit-security-key").onclick = function(e) {
|
||
|
e.preventDefault();
|
||
|
getWebauthnCredential(
|
||
|
document.getElementById("security-key-challenge").value,
|
||
|
document
|
||
|
.getElementById("security-key-allowed-credential-ids")
|
||
|
.value.split(","),
|
||
|
credentialData => {
|
||
|
document.getElementById("security-key-credential").value = JSON.stringify(
|
||
|
credentialData
|
||
|
);
|
||
|
|
||
|
$(e.target)
|
||
|
.parents("form")
|
||
|
.submit();
|
||
|
},
|
||
|
errorMessage => {
|
||
|
document.getElementById("security-key-error").innerText = errorMessage;
|
||
|
}
|
||
|
);
|
||
|
};
|