Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Project Website Template — Auth & Database Integrated

# project-website-template
Demo: https://yenchiah.github.io/project-website-template/

Expand Down
Empty file added api.js
Empty file.
12 changes: 12 additions & 0 deletions db-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// WARNING: Demo only. Do NOT store real credentials in client-side code.
const db = {
host: "localhost",
username: "admin",
password: "password123",
};

function connectDB() {
console.log("Connected to DB at " + db.host);
return true; // allow callers to assert success
}

23 changes: 23 additions & 0 deletions login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login Page</title>
</head>
<body>
<h2>User Login</h2>
<form id="loginForm">
<label for="username">Username:</label>
<input type="text" id="username" name="username" required><br><br>

<label for="password">Password:</label>
<input type="password" id="password" name="password" required><br><br>

<button type="submit">Login</button>
</form>

<script src="login.js"></script>
</body>
</html>

12 changes: 12 additions & 0 deletions login.js
Original file line number Diff line number Diff line change
@@ -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).");
}
});