-
Notifications
You must be signed in to change notification settings - Fork 1
/
signup.html
138 lines (116 loc) · 3.35 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<!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">
<title>Document</title>
<style>
body{
font-family: sans-serif;
background-color: rgb(44, 42, 42);
}
input{
padding: 5px;
height:37px;
width: 400px;
margin-top: 5px;
margin-bottom:18px;
border: 1px light grey
}
#details{
margin-left:500px;
font-weight:lighter;
color: #000000;
font:16px ,montserrat,sans-serif;
}
h1{
text-align: center;
padding-bottom: 30px;
padding-top:10px;
font-size: 50px;
font-weight: lighter;
color: white;
margin-left: 20px;
}
p{
margin-left: 580px;
margin-top: -40px;
margin-bottom: 40px;
color: white;
}
#create{
border:1px solid red;
background-color: red;
font-weight: bold;
color:white;
height:42px;
font-size: 17px;
border-radius: 5px;
width: 410px;}
a{
text-decoration: none;
color: black;
}
a{
color: white;
}
a:hover{
text-decoration: underline;
}
#details>div>input:first-child{
background-color: rgb(44, 42, 42);
border-color: white;
border-radius: 5px;
height: 50px;
color: white;
font-size: 25px;
}
</style>
</head>
<body><div id="container">
<h1>Register</h1>
<p>Please fill in the fields below:</p>
<form>
<div id ="details">
<div><input id="firstname" tpye="text" placeholder="First Name"/></div>
<div><input id="lastname" type="text" placeholder="Last Name" /></div>
<div><input id="email" type="text" placeholder="Email" /></div>
<div><input id="password" type="password" placeholder="Password"/></div>
<input type ="submit" id="create" value="CREATE ACCOUNT" >
<div><a href ="" id="loginlin">Already have an account ?</a> <a href ="signIn.html" id="storelink">Login</a>
</div></form>
</div>
</body>
<script>
// 1st step
let form=document.querySelector("form");
let userData=JSON.parse(localStorage.getItem("userData"))||[];
// 2nd step
form.addEventListener("submit", function(event){
event.preventDefault();
let data={
name:form.name.value,
email:form.email.value,
password:form.password.value,
}
if (checkEmails(data.email)===true){
userData.push(data);
localStorage.setItem("userData",JSON.stringify(userData));
alert("Account Successfully created");
}else{
alert("Account Already Exists");
}
});
function checkEmails(email){
let filtered=userData.filter(function(element){
return email===element.email;
})
if(filtered.length>0){
return false;
}else{
return true;
}
}
</script>
</html>