-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.js
40 lines (24 loc) · 793 Bytes
/
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
let form=document.querySelector("form");
let signupData = JSON.parse(localStorage.getItem("masai")) || [];
form.addEventListener("submit", myFun )
function myFun(event) {
event.preventDefault()
let x = document.querySelector("#email").value
let y=document.querySelector("#password").value
let flag=false
function login(data) {
for (let i = 0; i <= data.length - 1; i++){
if (data[i].email === x && data[i].pass === y) {
flag=true
break;
}
}
if (flag == true) {
alert("Welcome To Top Trip 🎉")
window.location.href = "index.html";
} else {
alert("please fill correct details")
}
}
login(signupData)
}