-
Notifications
You must be signed in to change notification settings - Fork 0
/
signin.js
36 lines (25 loc) · 946 Bytes
/
signin.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 loginData=JSON.parse(localStorage.getItem("info")) || [];
let secureData=JSON.parse(localStorage.getItem("login")) || [];
document.querySelector("#lift").addEventListener("submit", loginEntries);
function loginEntries(event){
event.preventDefault();
let email=document.querySelector("#email").value;
let password=document.querySelector("#password").value;
let objLogin={
email:email,
password:password,
}
let flag=false;
let sign=document.querySelector("#sign");
loginData.forEach(function (elem){
if(elem.email==objLogin.email && elem.password==objLogin.password){
localStorage.setItem("login",JSON.stringify(secureData));
sign.innerText=elem.first;
alert("Successfully Loged In");
flag=true;
}
})
if(flag==false){
alert("Wrong Credentials");
}
}