33 lines
1018 B
JavaScript
33 lines
1018 B
JavaScript
(() => {
|
|
"use strict";
|
|
|
|
const form = document.getElementById("userdetail");
|
|
const resetPassword = document.getElementById("resetPassword");
|
|
const resetValue = document.getElementById("resetpass");
|
|
|
|
document.getElementById("loginid")?.focus();
|
|
|
|
resetPassword?.addEventListener("change", () => {
|
|
resetValue.value = resetPassword.checked ? "1" : "0";
|
|
});
|
|
|
|
document.getElementById("cancelUser")?.addEventListener("click", () => {
|
|
window.parent.postMessage({ type: "matrix:modal-close" }, window.location.origin);
|
|
});
|
|
|
|
form?.addEventListener("submit", (event) => {
|
|
if (!form.checkValidity()) {
|
|
event.preventDefault();
|
|
event.stopPropagation();
|
|
}
|
|
form.classList.add("was-validated");
|
|
});
|
|
|
|
if (document.body.dataset.saveComplete === "true") {
|
|
window.parent.postMessage({
|
|
type: "matrix:user-saved",
|
|
value: document.body.dataset.result
|
|
}, window.location.origin);
|
|
}
|
|
})();
|