-
Notifications
You must be signed in to change notification settings - Fork 3
/
signin.js
66 lines (52 loc) · 2.13 KB
/
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
let form=document.querySelector("form");
let userData=JSON.parse(localStorage.getItem("userData")) || [];
form.addEventListener("submit",function(event){
event.preventDefault();
let data={
email:form.email.value,
password:form.password.value,
}
if(checkSignin(data.email,data.password)===true){
localStorage.setItem("signin",JSON.stringify(data));
alert("Sign in Successful");
window.location.href="index.html";
}else{
let message=document.querySelector("#message")
message.innerText="Incorrect email or password."
}
})
function checkSignin(email,password){
let filter=userData.filter(function(element){
return element.email===email && element.password===password;
})
if(filter.length>0){
return true;
}else{
return false;
}
}
document.querySelector("#linkCreateAccount").addEventListener("click",createAccount)
function createAccount(){
window.location.href="signup.html"
}
document.querySelector("#passwordRecovery").addEventListener("click",recoveraccount)
function recoveraccount(){
window.location.href="password.html"
}
document.querySelector("#facebook").addEventListener("click",facebook)
function facebook(){
window.location.href="https://www.facebook.com/dotandkey/"
}
document.querySelector("#google").addEventListener("click",google)
function google(){
window.location.href="https://accounts.google.com/ServiceLogin/signinchooser?flowName=GlifWebSignIn&flowEntry=ServiceLogin"
}
document.querySelector('#logo').addEventListener("click",function(){
window.location.href="index.html";
})
document.querySelector('#location_aman').addEventListener("click",function(){
window.location.href="location.html";
})
document.querySelector('#profile_aman').addEventListener("click",function(){
window.location.href="signin.html";
})