-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
39 lines (33 loc) · 1.83 KB
/
script.js
File metadata and controls
39 lines (33 loc) · 1.83 KB
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
37
38
39
// List of 9 valid users with username, email, and password
const validUsers = [
{ username: "ӾⱤ-₣ɆⱤ₳₦₥ł≪", email: "feranmi@gmail.com", password: "≫ӾⱤ-₣ɆⱤ₳₦₥ł≪" },
{ username: "Kaybee", email: "abdulkabeer@gmail.com", password: "Kaybee123" },
{ username: "Muiz", email: "muiz@gmail.com", password: "Mueez123" },
{ username: "Idrees", email: "idrees@gmail.com", password: "idrees123" },
{ username: "Lateefa", email: "lafeeta@gmail.com", password: "Lateefa123" },
{ username: "Damilare", email: "damilare@gmail.com", password: "damilare123" },
{ username: "Abdullah", email: "abdullah@gmail.com", password: "abdullah123" },
{ username: "Dollypee", email: "dolapo@gmail.com", password: "dollapo123" },
{ username: "ART_Redox", email: "ridwan@gmail.com", password: "ridwan123" }
];
document.getElementById("login-form").addEventListener("submit", function (event) {
event.preventDefault();
const email = document.getElementById("email").value.trimStart().trimEnd();
const password = document.getElementById("password").value.trimStart().trimEnd();
const error = document.getElementById("error-message");
error.textContent = "";
if (!email || !password) {
error.textContent = "All fields are required.";
return;
}
if (password.length < 6) {
error.textContent = "Password must be at least 6 characters long.";
return;
}
const user = validUsers.find(u => u.email === email && u.password === password);
if (user) {
alert(`Hi ${user.username}! You are now logged in`);
} else {
error.textContent = "Invalid username, email, or password.";
}
});