|
|
|
|
|
const FIXED_USERNAME = "people"; |
|
|
const FIXED_PASSWORD = "home"; |
|
|
|
|
|
|
|
|
if (window.location.pathname.includes("app.html")) { |
|
|
if (!sessionStorage.getItem("isLoggedIn")) { |
|
|
window.location.href = "index.html"; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
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"; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function logout() { |
|
|
sessionStorage.removeItem("isLoggedIn"); |
|
|
window.location.href = "index.html"; |
|
|
} |
|
|
|
|
|
|
|
|
function signup() { |
|
|
alert("Signup is disabled. Use the provided demo credentials."); |
|
|
} |
|
|
|