-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSignup.html
123 lines (121 loc) · 3.25 KB
/
Signup.html
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300&display=swap"
rel="stylesheet"
/>
<title>Visitor_Sign UP page</title>
<style>
* {
margin: 0px;
padding: 0px;
font-family: "Open Sans", sans-serif;
}
body {
background-color: #cbcbcb75;
}
#main {
background-color: #48c9b0;
/* box-shadow: rgba(100, 100, 111, 0.2) 0px 7px 29px 0px; */
box-shadow: rgba(0, 0, 0, 0.25) 0px 54px 55px,
rgba(0, 0, 0, 0.12) 0px -4px 30px, rgba(0, 0, 0, 0.12) 0px 4px 6px,
rgba(0, 0, 0, 0.17) 0px 12px 13px, rgba(0, 0, 0, 0.09) 0px -3px 5px;
display: flex;
align-items: center;
flex-direction: column;
width: 30%;
margin: 5% auto 10% auto;
padding-bottom: 4%;
}
#main > h1 {
color: white;
font-weight: 100;
margin-top: 7%;
margin-bottom: 7%;
}
#main > form {
width: 80%;
margin: auto;
}
#main > form > input {
width: 90%;
height: 50px;
margin: 2%;
border: none;
padding: 2%;
padding-left: 6%;
font-size: 18px;
background-color: rgb(234, 234, 234);
}
#main > form > button {
width: 98%;
height: 50px;
margin: 2%;
border: none;
padding: 2%;
font-size: 18px;
background-color: #17a589;
color: white;
font-weight: bold;
cursor: pointer;
}
p {
color: white;
display: flex;
justify-content: center;
}
p > a {
text-decoration: none;
font-weight: bold;
margin-left: 2%;
color: rgb(255, 255, 255);
}
</style>
</head>
<body>
<div id="main">
<h1>- Visitor -</h1>
<form>
<input id="email" type="email" placeholder="Email" />
<input id="password" type="password" placeholder="Enter password" />
<input id="number" type="tel" maxlength="10" placeholder="Number" />
<button id="signup">SIGN UP</button>
<!-- <button>LOG IN</button> -->
<p>Already have an account? <a href="login.html">LOG IN</a></p>
</form>
</div>
</body>
</html>
<script>
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,
number: form.number.value,
};
if (checkEmail(data.email) === true) {
userData.push(data);
localStorage.setItem("userdata", JSON.stringify(userData));
window.location.href = "login.html";
} else {
alert("Account already exists");
}
});
function checkEmail(email) {
let filtered = userData.filter(function (element) {
return email === element.email;
});
if (filtered.length > 0) {
return false;
} else {
return true;
}
}
</script>