import {post_request} from "./js/lib.js"; const form = document.getElementById("form"); form.addEventListener('submit', formHandler); const form_status = document.getElementById("formStatus"); const button = document.getElementById("button"); button.addEventListener('submit', formHandler); async function formHandler(listener) { listener.preventDefault(); const formData = new FormData(form); const user = formData.get("user"); const pass = formData.get("pass"); const newPW = formData.get("newPW"); if (newPW !== formData.get("newPWConfirm")) { document.getElementById('formStatus').innerHTML = "Failure: new passwords don't match"; return; } const body = {auth: {user: user, pass: pass}, field: "userPassword", value: newPW} let url = 'https://api.account.skynet.ie/ldap/update'; await post_request(url, body, form_status); }