diff --git a/README.md b/README.md index 9272c2b4..94e5ebc8 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +# Project Website Template — Auth & Database Integrated + # project-website-template Demo: https://yenchiah.github.io/project-website-template/ diff --git a/db-config.js b/db-config.js new file mode 100644 index 00000000..37ea8028 --- /dev/null +++ b/db-config.js @@ -0,0 +1,16 @@ +// WARNING: Demo only. Do NOT store real credentials in client-side code. +const db = { + host: "localhost", + username: "admin", + password: "password123", +}; + +/** + * Connect to the demo DB. + * @returns {boolean} true if the (mock) connection succeeded + */ +function connectDB() { + console.log("Connected to DB at " + db.host); + return true; +} + diff --git a/login.html b/login.html new file mode 100644 index 00000000..553ee4fe --- /dev/null +++ b/login.html @@ -0,0 +1,23 @@ + + + + + + Login Page + + +

User Login

+
+ +

+ + +

+ + +
+ + + + + diff --git a/login.js b/login.js new file mode 100644 index 00000000..1a17a8aa --- /dev/null +++ b/login.js @@ -0,0 +1,12 @@ +document.getElementById("loginForm").addEventListener("submit", function(event) { + event.preventDefault(); // prevent page reload + + const username = document.getElementById("username").value.trim(); + const password = document.getElementById("password").value.trim(); + + if (username === "" || password === "") { + alert("Please fill in both fields."); + } else { + alert("Login successful (demo only)."); + } +});