mirror of
https://github.com/discourse/discourse.git
synced 2024-12-01 18:18:33 +08:00
c3fd91670e
Re-lands #16119 and #17298 * Update eslint-config-discourse * Update linting workflow * Prettier-ignore stuff * Update template-lint config * Auto-fix template issues * Fix various template issues Mostly incorrect attributes and unused templates * Prettier js files * Fix template auto-fix regressions * Small css tweak Co-authored-by: Peter Wagenet <peter.wagenet@gmail.com>
24 lines
722 B
JavaScript
24 lines
722 B
JavaScript
import { getWebauthnCredential } from "discourse/lib/webauthn";
|
|
|
|
const security = document.getElementById("submit-security-key");
|
|
if (security) {
|
|
security.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;
|
|
}
|
|
);
|
|
};
|
|
}
|