File size: 929 Bytes
168404c ee36313 168404c ee36313 168404c ee36313 168404c ee36313 168404c ee36313 168404c ee36313 168404c ee36313 686ba12 168404c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
// Fixed credentials
const FIXED_USERNAME = "people";
const FIXED_PASSWORD = "home";
// Protect app.html
if (window.location.pathname.includes("app.html")) {
if (!sessionStorage.getItem("isLoggedIn")) {
window.location.href = "index.html";
}
}
// Login function
function login() {
const user = document.getElementById("username").value;
const pass = document.getElementById("password").value;
const message = document.getElementById("message");
if (user === FIXED_USERNAME && pass === FIXED_PASSWORD) {
sessionStorage.setItem("isLoggedIn", "true");
window.location.href = "app.html";
} else {
message.innerText = "❌ Invalid username or password";
}
}
// Logout
function logout() {
sessionStorage.removeItem("isLoggedIn");
window.location.href = "index.html";
}
// Disable signup (optional safety)
function signup() {
alert("Signup is disabled. Use the provided demo credentials.");
}
|