-
Notifications
You must be signed in to change notification settings - Fork 0
/
signup.html
254 lines (232 loc) · 6.37 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
<!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>Signup</title>
<style>
* {
margin: 0;
padding: 0;
font-family: "poppins", sans-serif;
box-sizing: border-box;
}
a {
text-decoration: none;
color: #5a5a5a;
}
img {
cursor: pointer;
}
.flex-div {
display: flex;
align-items: center;
}
nav {
padding: 10px 2%;
justify-content: space-between;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
background: #fff;
position: sticky;
top: 0;
z-index: 10;
}
.nav-right img {
width: 35px;
height: 35px;
margin-right: 25px;
}
.nav-right .user-icon {
width: 40px;
border-radius: 50%;
margin-right: 0;
}
.nav-left .menu-icon {
width: 23px;
height: 18px;
margin-right: 25px;
}
.nav-left .logo {
width: 110px;
background: none;
}
.nav-middle .mic-icon {
width: 18px;
}
.nav-middle .search-box {
border: 1px solid #ccc;
margin-right: 15px;
padding: 10px 15px;
border-radius: 25px;
}
.nav-middle .search-box input {
width: 400px;
border: 0;
outline: 0;
background: transparent;
font-size: 15px;
}
.nav-middle .search-box img {
width: 15px;
}
#container2 {
display: flex;
flex-direction: row;
text-align: center;
box-shadow: rgba(100, 100, 111, 0.2) 0px 7px 29px 0px;
}
img {
width: 95%;
}
.search-btn {
width: 23px;
height: 18px;
}
#container2 {
padding-left: 17%;
padding-right: 2%;
padding-bottom: 20px;
display: flex;
flex-direction: row;
justify-content: center;
margin-top: 100px;
}
#register-form {
height: 500px;
margin-bottom: 200px;
width: 500px;
text-align: center;
margin-left: 400px;
box-shadow: rgba(0, 0, 0, 0.25) 0px 54px 55px,
rgba(0, 0, 0, 0.12) 0px -12px 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;
}
#register-form > h1 {
margin-top: 50px;
}
form {
margin-top: 0;
}
form > input {
margin-top: 4%;
width: 100%;
height: 35px;
text-align: center;
font-size: 20px;
border-radius: 10px;
}
#btn {
margin-top: 15px;
width: 50%;
height: 40px;
border-radius: 10px;
font-size: 20px;
cursor: pointer;
}
</style>
</head>
<body>
<nav class="flex-div">
<div class="nav-left flex-div">
<img class="menu-icon" src="images/menu.png" alt="" />
<img
onclick="gotoSub()"
class="logo"
src="https://upload.wikimedia.org/wikipedia/commons/3/34/YouTube_logo_%282017%29.png"
alt=""
/>
</div>
<div class="nav-middle flex-div">
<div class="search-box flex-div">
<input type="text" id="query" placeholder="Search" />
<img
class="search-btn"
onclick="searchVideos()"
src="images/search.png"
alt=""
/>
</div>
<img class="mic-icon" src="images/voice-search.png" alt="" />
</div>
<div class="nav-right flex-div">
<img src="images/upload.png" alt="" />
<img src="images/more.png" alt="" />
<img class="logo" src="images/notification.png" alt="" />
<img class="user-icon" src="images/Jack.png" />
</div>
</nav>
<div id="container">
<div id="register-form">
<h1>Sign-Up</h1>
<form action="">
<input type="text" id="name" placeholder="Name" />
<input type="email" id="email" placeholder="E-mail" />
<input type="text" id="username" placeholder="Username" />
<input type="password" id="password" placeholder="Password (min 8 char)" />
<input type="number" id="mobile" placeholder="Mobile" />
<input type="text" id="description" placeholder="Description" />
</form>
<button id="btn" onclick="Register()">Sign-Up</button>
<p style="margin-top: 10px">
Already Have An account<a style="color: blue" href="login.html">
Log-In</a
>
</p>
</div>
</div>
</body>
</html>
<script>
class User {
constructor(n) {}
#checkUsername(username) {
let value = username.includes("#") ? false : true;
return value;
}
#checkPassword(password) {
let value = password.length >= 8 ? true : false;
return value;
}
async Signup(n, e, u, p, m, d) {
let isValidated = this.#checkUsername(u) && this.#checkPassword(p);
if (isValidated) {
this.name = n;
this.email = e;
this.username = u;
this.password = p;
this.mobile = m;
this.description = d;
let actual_data = JSON.stringify(this);
try {
let res = await fetch(
`https://masai-api-mocker.herokuapp.com/auth/register`,
{
method: "POST",
body: actual_data,
headers: {
"Content-Type": "application/json",
},
}
);
let data = await res.json();
console.log("data:", data);
alert(data.message);
} catch (error) {
console.log("error:", error);
}
window.location.href = "login.html";
}
}
}
let u1 = new User();
function Register() {
const name = document.getElementById("name").value;
const email = document.getElementById("email").value;
const username = document.getElementById("username").value;
const password = document.getElementById("password").value;
const mobile = document.getElementById("mobile").value;
const description = document.getElementById("description").value;
u1.Signup(name, email, username, password, mobile, description);
}
</script>