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:
commit
d618bea3dc
1 changed files with 6 additions and 8 deletions
|
@ -4,16 +4,14 @@ formEl.addEventListener('submit', (listener) => formHandler(listener));
|
||||||
function formHandler(listener){
|
function formHandler(listener){
|
||||||
listener.preventDefault();
|
listener.preventDefault();
|
||||||
const formData = new FormData(formEl);
|
const formData = new FormData(formEl);
|
||||||
if(formData.get("newPW") === formData.get("newPWConfirm")){
|
const user = formData.get("user");
|
||||||
formData.delete("newPWConfirm");
|
const pass = formData.get("password");
|
||||||
const newPW = formData.get("newPW");
|
const newPW = formData.get("newPW");
|
||||||
formData.delete("newPW");
|
if(newPW === formData.get("newPWConfirm")){
|
||||||
formData.append("field", "password");
|
const object = {user: user, pass: pass, field: "userPassword", value: newPW}
|
||||||
formData.append("value", newPW);
|
|
||||||
const object = Object.fromEntries(formData.entries());
|
|
||||||
fetch('https://api.sso.skynet.ie/ldap/update', {
|
fetch('https://api.sso.skynet.ie/ldap/update', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: object
|
body: JSON.stringify(object)
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if(res.status === 200) {
|
if(res.status === 200) {
|
||||||
document.getElementById('formStatus').innerHTML = "<span style='background-color: green; color: white'>Success</span>";
|
document.getElementById('formStatus').innerHTML = "<span style='background-color: green; color: white'>Success</span>";
|
||||||
|
|
Loading…
Reference in a new issue