diff --git a/static/build/index.js b/static/build/index.js index b4aa577..68990bb 100644 --- a/static/build/index.js +++ b/static/build/index.js @@ -14,6 +14,11 @@ document.addEventListener("DOMContentLoaded", function () { submitSignup(); }); + const usernameInput = document.getElementById("signup_username"); + usernameInput.addEventListener("blur", function () { + checkUsernameAvailability(); + }); + loginForm.addEventListener("submit", function (event) { event.preventDefault(); // Prevent the form from being submitted normally @@ -31,15 +36,9 @@ document.addEventListener("DOMContentLoaded", function () { } }); -const usernameInput = document.getElementById("signup-username"); -usernameInput.addEventListener("blur", function () { - checkUsernameAvailability(); -}); - - function checkUsernameAvailability() { - const usernameInput = document.getElementById("signup-username"); + const usernameInput = document.getElementById("signup_username"); const availabilityDiv = document.getElementById("usernameAvailability"); // Get the value of the username input @@ -78,18 +77,18 @@ function submitSignup() { submitBtn.innerHTML = ''; submitBtn.appendChild(spinner); - // Get the values of the signup form fields + // Get the values of the form fields + const signup_username = document.getElementById("signup_username").value; + const signup_password = document.getElementById("signup_password").value; const name = document.getElementById("name").value; const email = document.getElementById("email").value; - const username = document.getElementById("signup-username").value; - const password = document.getElementById("signup-password").value; // Create a new FormData object and append the values const formData = new FormData(); formData.append("name", name); formData.append("email", email); - formData.append("username", username); - formData.append("password", password); + formData.append("username", signup_username); + formData.append("password", signup_password); // Send the signup request as form data const xhr = new XMLHttpRequest(); diff --git a/templates/index.html b/templates/index.html index ac8ef6a..b6bc51a 100644 --- a/templates/index.html +++ b/templates/index.html @@ -10,26 +10,6 @@ href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"> - @@ -176,7 +156,7 @@