mirror of
https://github.com/milk-net/milk-net.github.io.git
synced 2025-04-19 17:43:42 -05:00
Create auth.js
This commit is contained in:
parent
1bac59d42f
commit
a7726c278a
1 changed files with 20 additions and 0 deletions
20
forum/auth.js
Normal file
20
forum/auth.js
Normal file
|
@ -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");
|
||||
}
|
||||
});
|
Loading…
Add table
Reference in a new issue