-
Notifications
You must be signed in to change notification settings - Fork 4
/
SignUp.html
128 lines (120 loc) · 3.68 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
<!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>Sephora-SignUp</title>
<link rel="icon" href="https://static.nnnow.com/client/assets/images/favicon.ico">
<style>
* {
box-sizing: border-box;
}
h1 {
text-align: center;
margin-bottom: 40px;
padding: 0px 20px 0px 20px;
}
#container{
width:350px;
border: 1px solid white;
border-radius: 15px;
margin:auto;
margin-top: 40px;
padding:0px 15px 0px 15px;
box-shadow: rgba(100, 100, 111, 0.2) 0px 7px 29px 0px;
}
#container > form{
width:94%;
margin:auto;
margin-bottom:30px;
}
input{
width: 100%;
margin:8px;
margin-left: 0px;
margin-bottom: 10px;
padding: 10px;
font-size: medium;
border:1px solid grey;
border-radius: 5px;
}
input + p {
font-size: 14px;
margin-left: 10px;
margin-right: 10px;
margin-top:20px;
text-align: center;
}
#ptag{
color:grey;
font-size: 16px;
text-align: center;
margin-top: 20px;
margin-bottom: 0px;
}
#signup{
margin-top: 20px;
padding:10px;
width: 100%;
font-size: medium;
color:white;
background-color: #FF3399;
border:1px solid white;
border-radius: 5px;
}
label {
font-size: medium;
}
span {
color:blue;
}
</style>
</head>
<body>
<div id="container">
<h1>CREATE ACCOUNT</h1>
<form id="form" >
<label for="">Full name</label><br>
<input id="name" type="text" placeholder="Enter your Full name"><br>
<label for="">Email</label><br>
<input id="email" type="email" placeholder="Enter email"><br>
<label for="">Password</label><br>
<input id="password" type="password" placeholder="Enter password">
<input id="signup" type="submit" value="Sign Up" />
<p id="ptag">Already have an account? <span><a href="sale.html">Sign In</a></span></p>
</form>
</div>
</body>
</html>
<script>
document.querySelector("form").addEventListener("submit", mySignUp);
let userArr=JSON.parse(localStorage.getItem("userData")) || [];
function mySignUp(event){
event.preventDefault();
let queObj={
userName: document.querySelector("#name").value,
userEmail: document.querySelector("#email").value,
userPwd: document.querySelector("#password").value,
};
let flag=false;
if(userArr.length>=1){
console.log("x");
userArr.forEach(function (el) {
if(el.userName==queObj.userName && el.userEmail==queObj.userEmail && el.userPwd==queObj.userPwd){
flag=true;
}
});
}if(flag==true){
alert("You Already have an Account, Please Login!");
window.location.href="homepage.html";
}
else{
console.log("y");
userArr.push(queObj);
alert("Account Created Successfully!");
window.location.href="sale.html";
localStorage.setItem("userData", JSON.stringify(userArr));
}
}
</script>