-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
23 lines (19 loc) · 798 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const users = [
{ username: 'ADMIN', password: 'ADMIN' },
{ username: 'Gamjub', password: 'TheGemjub1234' },
{ username: 'DenisH', password: 'Stitch' },
];
document.getElementById("loginForm").addEventListener("submit", function (event) {
event.preventDefault();
const username = document.getElementById("username").value;
const password = document.getElementById("password").value;
const user = users.find(user => user.username === username && user.password === password);
if (user) {
// Login erfolgreich
localStorage.setItem("loggedInUser", username);
window.location.href = "home.html";
} else {
// Fehlermeldung
document.getElementById("error-message").textContent = "Benutzername oder Passwort ist falsch!";
}
});