Reformating code to standard

#3
This commit is contained in:
eoghan.conlon 2023-08-05 16:49:48 +01:00
parent f105b8dcc0
commit 811d41aa3d

View file

@ -9,11 +9,11 @@
<h1>Sign-up</h1> <h1>Sign-up</h1>
<form id="register"> <form id="register">
<label for="user">Username</label> <label for="user">Username</label>
<input type="text" id="user" name="user" /> <br /> <input type="text" id="user" name="user"/> <br/>
<label for="pass">Password</label> <label for="pass">Password</label>
<input type="password" id="pass" name="pass" /> <br /> <input type="password" id="pass" name="pass"/> <br/>
<label for="confirm">Confirm</label> <label for="confirm">Confirm</label>
<input type="password" id="confirm" name="confirm" /> <input type="password" id="confirm" name="confirm"/>
<input type="Submit" value="Submit"/> <input type="Submit" value="Submit"/>
</form> </form>
<p id="formStatus"></p> <p id="formStatus"></p>
@ -24,11 +24,11 @@
const formEl = document.getElementById("register"); const formEl = document.getElementById("register");
formEl.addEventListener('submit', (listener) => formHandler(listener)); formEl.addEventListener('submit', (listener) => formHandler(listener));
function formHandler(listener){ function formHandler(listener) {
listener.preventDefault(); listener.preventDefault();
const formData = new FormData(formEl); const formData = new FormData(formEl);
const pass = formData.get("pass"); const pass = formData.get("pass");
if(pass === formData.get("confirm")) { if (pass === formData.get("confirm")) {
const url = new URL(window.location.href); const url = new URL(window.location.href);
const urlParam = new URLSearchParams(url.search); const urlParam = new URLSearchParams(url.search);
const auth = urlParam.get("auth"); const auth = urlParam.get("auth");