diff --git a/src/recovery/ssh-request.html b/src/recovery/ssh-request.html
index bf93aae..31afe18 100644
--- a/src/recovery/ssh-request.html
+++ b/src/recovery/ssh-request.html
@@ -28,7 +28,36 @@
listener.preventDefault();
const formData = new FormData(formEl);
const object = { user: formData.get('user'), email: formData.get('mail')};
- alert(JSON.stringify(object));
+ fetch('https://api.account.skynet.ie/ldap/recover/ssh/request', {
+ method: 'POST',
+ body: JSON.stringify(object),
+ mode: "cors"
+ })
+ .then(status)
+ .then(json)
+ .catch(() => {
+ document.getElementById('formStatus').innerHTML = "Please try again";
+ });
+ }
+
+ function status(res){
+ if(res.status === 200){
+ return res.json();
+ } else if (res.status === 500){
+ document.getElementById('formStatus').innerHTML = "Failure";
+ } else {
+ document.getElementById('formStatus').innerHTML = "Failure: Failed to communicate to server";
+ }
+ }
+
+ function json(temp){
+ if(temp){
+ if(temp.result === 'error'){
+ document.getElementById('formStatus').innerHTML = `${temp.error}`;
+ } else {
+ document.getElementById('formStatus').innerHTML = "Success";
+ }
+ }
}