From a7726c278a04b3dc2c1aff18047e65a868acbc15 Mon Sep 17 00:00:00 2001 From: Voxel Date: Tue, 15 Apr 2025 16:19:33 -0400 Subject: [PATCH] Create auth.js --- forum/auth.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 forum/auth.js diff --git a/forum/auth.js b/forum/auth.js new file mode 100644 index 0000000..63c33c6 --- /dev/null +++ b/forum/auth.js @@ -0,0 +1,20 @@ +document.getElementById("auth-form").addEventListener("submit", function (event) { + event.preventDefault(); + + const username = document.getElementById("username").value; + const password = document.getElementById("password").value; + + const turnstileResponse = document.querySelector(".cf-turnstile-response").value; + if (!turnstileResponse) { + alert("Please complete the CAPTCHA"); + return; + } + + // Simulate authentication (In a real application, verify credentials and CAPTCHA on the server) + if (username && password) { + localStorage.setItem("username", username); + window.location.href = "index.html"; + } else { + alert("Invalid login credentials"); + } +});