Feat. Auth is taken directly from the URL, auth on form removed

#3
This commit is contained in:
eoghan.conlon 2023-08-05 16:39:02 +01:00
parent 4a1fb8481b
commit 20e284fb13

View file

@ -8,8 +8,6 @@
<body>
<h1>Sign-up</h1>
<form id="register">
<label for="auth">Auth code</label>
<input type="text" id="auth" name="auth" /> <br/>
<label for="user">Username</label>
<input type="text" id="user" name="user" /> <br />
<label for="pass">Password</label>
@ -27,10 +25,12 @@
function formHandler(listener){
listener.preventDefault();
const formData = new FormData(formEl);
const auth = formData.get("auth");
const url = new URL(window.location.href);
const urlParam = new URLSearchParams(url.search);
const auth = urlParam.get("auth");
const user = formData.get("user");
const pass = formData.get("pass");
const object = { auth: auth, user: user, pass: pass }
const object = { auth: auth, user: user, pass: pass };
fetch('https://api.sso.skynet.ie/ldap/new', {
method: 'POST',
body: JSON.stringify(object),
@ -53,7 +53,7 @@
}
}
})
.catch(() => document.getElementById('formStatus').innerHTML = "<span style='background-color: yellow; color: black'>Please try again</span>")
.catch(() => document.getElementById('formStatus').innerHTML = "<span style='background-color: yellow; color: black'>Please try again</span>");
}
</script>
</body>