-
Notifications
You must be signed in to change notification settings - Fork 3
/
signup.js
60 lines (49 loc) · 1.9 KB
/
signup.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
let form=document.querySelector("form")
let userData=JSON.parse(localStorage.getItem("userData")) || [];
form.addEventListener("submit",function(event){
event.preventDefault();
let data={
name:form.name1.value,
name:form.name2.value,
email:form.email.value,
password:form.password.value,
}
if(checkEmails(data.email)===true){
userData.push(data);
localStorage.setItem("userData",JSON.stringify(userData))
}else{
alert("Account Already Exist");
window.location.href="signin.html";
}
})
function checkEmails(email){
let filtered=userData.filter(function(element){
return email===element.email
})
if(filtered.length>0){
return false;
}else{
return true;
}
}
document.querySelector("#linkLogin").addEventListener("click",createAccount)
function createAccount(){
window.location.href="signin.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";
})