[Email Change] Refactoring script and html form for email rather than password

#1
This commit is contained in:
eoghan.conlon 2023-07-29 22:37:20 +01:00
parent 693acc7946
commit f3d51c205d
2 changed files with 8 additions and 8 deletions

View file

@ -6,9 +6,9 @@ function formHandler(listener){
const formData = new FormData(formEl); const formData = new FormData(formEl);
const user = formData.get("user"); const user = formData.get("user");
const pass = formData.get("pass"); const pass = formData.get("pass");
const newPW = formData.get("newPW"); const newEmail = formData.get("newEmail");
if(newPW === formData.get("newPWConfirm")){ if(newEmail === formData.get("newEmail2")){
const object = {user: user, pass: pass, field: "userPassword", value: newPW} const object = {user: user, pass: pass, field: "mail", value: newEmail}
fetch('https://api.sso.skynet.ie/ldap/update', { fetch('https://api.sso.skynet.ie/ldap/update', {
method: 'POST', method: 'POST',
body: JSON.stringify(object) body: JSON.stringify(object)

View file

@ -9,12 +9,12 @@
<form id="reset"> <form id="reset">
<label for="user">Username</label> <label for="user">Username</label>
<input type="text" id="user" name="user" /> <br /> <input type="text" id="user" name="user" /> <br />
<label for="pass">Old Password</label> <label for="pass">Password</label>
<input type="password" id="pass" name="pass" /> <br /> <input type="password" id="pass" name="pass" /> <br />
<label for="newPW1">New Password</label> <label for="newEmail">New email</label>
<input type="password" id="newPW1" name="newPW" /> <br /> <input type="email" id="newEmail" name="newPW" /> <br />
<label for="newPW2">Confirm</label> <label for="newEmail2">Confirm</label>
<input type="password" id="newPW2" name="newPWConfirm" /> <br /> <input type="email" id="newEmail2" name="newPWConfirm" /> <br />
<input type="Submit" value="Submit" /> <input type="Submit" value="Submit" />
</form> </form>
<p id="formStatus"></p> <p id="formStatus"></p>