forked from Jasmine-Shaikh/Zara-Clone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.js
46 lines (34 loc) · 1.33 KB
/
login.js
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
40
41
42
43
44
45
46
var userData = JSON.parse(localStorage.getItem("userDataBase"));
function clickForPass() {
var height = (document.querySelector("#inputEmail").style.height = "block");
var passwd = (document.querySelector("#inputPasswd").style.display = "block");
}
document.querySelector("#form").addEventListener("submit", logInBtn);
function logInBtn(event) {
event.preventDefault();
var email = document.querySelector("#inputEmail").value;
var password = document.querySelector("#inputPasswd").value;
var count = 0;
for (var i = 0; i < userData.length; i++) {
if (userData[i].email == email && userData[i].password == password) {
count = 1;
}
}
if (count == 1) {
alert("Login Successful");
window.location.href = "homePage.html";
} else {
alert("Invalid Credentials");
}
}
// -------------------------Category Modal----------------------
var menuModal = document.getElementById('menuModal');
document.querySelector('.close').addEventListener('click', function() {
menuModal.classList.add('animatedMenuShow');
})
menuModal.addEventListener('animationend', function() {
if (this.classList.contains('animatedMenuShow')) {
this.style.display = 'none';
this.classList.remove('animatedMenuShow')
}
});