Merge branch 'main-patch-5a28' into 'main'

ldap: fixes for the update page

See merge request compsoc/skynet/ldap/frontend!1
This commit is contained in:
eoghanconlon73 2023-07-29 17:13:37 +00:00
commit d618bea3dc

View file

@ -4,16 +4,14 @@ formEl.addEventListener('submit', (listener) => formHandler(listener));
function formHandler(listener){
listener.preventDefault();
const formData = new FormData(formEl);
if(formData.get("newPW") === formData.get("newPWConfirm")){
formData.delete("newPWConfirm");
const newPW = formData.get("newPW");
formData.delete("newPW");
formData.append("field", "password");
formData.append("value", newPW);
const object = Object.fromEntries(formData.entries());
const user = formData.get("user");
const pass = formData.get("password");
const newPW = formData.get("newPW");
if(newPW === formData.get("newPWConfirm")){
const object = {user: user, pass: pass, field: "userPassword", value: newPW}
fetch('https://api.sso.skynet.ie/ldap/update', {
method: 'POST',
body: object
body: JSON.stringify(object)
}).then(res => {
if(res.status === 200) {
document.getElementById('formStatus').innerHTML = "<span style='background-color: green; color: white'>Success</span>";