diff --git a/src/register.html b/src/register.html
index ff25e61..cfd3079 100644
--- a/src/register.html
+++ b/src/register.html
@@ -11,7 +11,9 @@
-
+
+
+
@@ -25,35 +27,39 @@
function formHandler(listener){
listener.preventDefault();
const formData = new FormData(formEl);
- 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 };
- fetch('https://api.sso.skynet.ie/ldap/new', {
- method: 'POST',
- body: JSON.stringify(object),
- mode: "cors"
- }).then(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";
- }
- })
- .then((temp) => {
- if(temp){
- if(temp.result === 'error'){
- document.getElementById('formStatus').innerHTML = `${temp.error}`;
- } else {
- document.getElementById('formStatus').innerHTML = "Success";
- }
+ if(pass === formData.get("confirm")) {
+ const url = new URL(window.location.href);
+ const urlParam = new URLSearchParams(url.search);
+ const auth = urlParam.get("auth");
+ const user = formData.get("user");
+ const object = {auth: auth, user: user, pass: pass};
+ fetch('https://api.sso.skynet.ie/ldap/new', {
+ method: 'POST',
+ body: JSON.stringify(object),
+ mode: "cors"
+ }).then(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";
}
})
- .catch(() => document.getElementById('formStatus').innerHTML = "Please try again");
+ .then((temp) => {
+ if (temp) {
+ if (temp.result === 'error') {
+ document.getElementById('formStatus').innerHTML = `${temp.error}`;
+ } else {
+ document.getElementById('formStatus').innerHTML = "Success";
+ }
+ }
+ })
+ .catch(() => document.getElementById('formStatus').innerHTML = "Please try again");
+ } else {
+ document.getElementById('formStatus').innerHTML = `Passwords don't match`;
+ }
}