diff --git a/src/register.html b/src/register.html index 6abd587..ac69ddf 100644 --- a/src/register.html +++ b/src/register.html @@ -16,6 +16,7 @@ +

@@ -31,6 +32,24 @@ const pass = formData.get("pass"); const object = { auth: auth, user: user, pass: pass } 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 = `${temp.error}`; + } else { + document.getElementById('formStatus').innerHTML = "Success"; + } + } else if (res.status === 500) { + document.getElementById('formStatus').innerHTML = "Failure"; + } else { + document.getElementById('formStatus').innerHTML = "Failure: Failed to communicate to server"; + } + }).catch(() => document.getElementById('formStatus').innerHTML = "Please try again") }