parent
f1e819bab9
commit
a8de7c72e1
1 changed files with 19 additions and 0 deletions
|
@ -16,6 +16,7 @@
|
||||||
<input type="password" id="pass" name="pass" />
|
<input type="password" id="pass" name="pass" />
|
||||||
<input type="Submit" value="Submit"/>
|
<input type="Submit" value="Submit"/>
|
||||||
</form>
|
</form>
|
||||||
|
<p id="formStatus"></p>
|
||||||
<footer>
|
<footer>
|
||||||
UL Computer Society 2023-<span id="year">2023</span>
|
UL Computer Society 2023-<span id="year">2023</span>
|
||||||
</footer>
|
</footer>
|
||||||
|
@ -31,6 +32,24 @@
|
||||||
const pass = formData.get("pass");
|
const pass = formData.get("pass");
|
||||||
const object = { auth: auth, user: user, pass: pass }
|
const object = { auth: auth, user: user, pass: pass }
|
||||||
alert(JSON.stringify(object));
|
alert(JSON.stringify(object));
|
||||||
|
fetch('https://api.sso.skynet.ie/ldap/new', {
|
||||||
|
method: 'POST',
|
||||||
|
body: JSON.stringify(object),
|
||||||
|
mode: "cors"
|
||||||
|
}).then(res => {
|
||||||
|
if (res.status === 200) {
|
||||||
|
let temp = res.json();
|
||||||
|
if(temp.result === 'error'){
|
||||||
|
document.getElementById('formStatus').innerHTML = `<span style='background-color: red; color: white'>${temp.error}</span>`;
|
||||||
|
} else {
|
||||||
|
document.getElementById('formStatus').innerHTML = "<span style='background-color: green; color: white'>Success</span>";
|
||||||
|
}
|
||||||
|
} else if (res.status === 500) {
|
||||||
|
document.getElementById('formStatus').innerHTML = "<span style='background-color: red; color: white'>Failure</span>";
|
||||||
|
} else {
|
||||||
|
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>")
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in a new issue