diff --git a/src/recovery.html b/src/recovery.html index ac4f399..022f18a 100644 --- a/src/recovery.html +++ b/src/recovery.html @@ -38,7 +38,21 @@ } else { object = { user: value }; } - alert(JSON.stringify(object)); + fetch('https://api.account.skynet.ie/ldap/recover/password', { + method: 'POST', + body: JSON.stringify(object), + mode: "cors" + }).then(res => { + if(res.status === 200){ + 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"; + }) } }