parent
e689c05fca
commit
8d17037c0f
1 changed files with 27 additions and 18 deletions
|
@ -14,7 +14,11 @@
|
|||
<label for="field">Field</label>
|
||||
<select id="field">
|
||||
<option value="" selected="selected">Please select an option</option>
|
||||
<option value="email">Email</option>
|
||||
<option value="mail">Email</option>
|
||||
<option value="sshPublicKey">SSH key</option>
|
||||
<option value="cn">First name & Surname</option>
|
||||
<option value="sn">Surname</option>
|
||||
<option value="skDiscord">Discord username</option>
|
||||
</select>
|
||||
<br />
|
||||
<label for="value">Value</label>
|
||||
|
@ -32,10 +36,12 @@
|
|||
function formHandler(listener) {
|
||||
listener.preventDefault();
|
||||
const formData = new FormData(formEl);
|
||||
const field = formData.get("field");
|
||||
if (field !== "") {
|
||||
const user = formData.get("user");
|
||||
const pass = formData.get("pass");
|
||||
const newEmail = formData.get("value");
|
||||
const object = {user: user, pass: pass, field: "mail", value: newEmail}
|
||||
const value = formData.get("value");
|
||||
const object = {user: user, pass: pass, field: field, value: value}
|
||||
fetch('https://api.sso.skynet.ie/ldap/update', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(object)
|
||||
|
@ -48,6 +54,9 @@
|
|||
document.getElementById('formStatus').innerHTML = "<span style='background-color: red; color: white'>Failure: Failed to communicate to server</span>";
|
||||
}
|
||||
}).catch(() => document.getElementById('formStatus').innerHTML = "<span style='background-color: yellow; color: black'>Please try again</span>");
|
||||
} else {
|
||||
document.getElementById('formStatus').innerHTML = "<span style='background-color: red; color: white'>Please select a field to modify</span>";
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
|
Loading…
Reference in a new issue