-
Notifications
You must be signed in to change notification settings - Fork 1
/
signUp.html
310 lines (212 loc) · 9.14 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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
<!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">
<script src="https://kit.fontawesome.com/2bdb37b8af.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="./styles/signUp.css">
<title>Document</title>
</head>
<body>
<div id="top">
<div>
<a href="index.html"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/1/1b/EBay_logo.svg/2560px-EBay_logo.svg.png"></a>
</div>
<div>
<p>Already a member?<a href="signin.html">Sign in</a></p>
</div>
</div>
<div id="upperBox">
<div class="setCenter"> <i class="fas fa-info-circle"></i></div>
<div>
To buy and sell on <span><a class="underLine" href="">www.ebay.com</a></span> or other eBay sites
internationally, existing users can login using
their credentials or new users can register an eBay account on ebay.in. Kindly note you can no
longer
buy or sell on eBay.in.
</div>
</div>
<div id="main">
<h1>Create Account</h1>
<div id="checks">
<div>
<input type="checkbox" class="checkbox-round" id="personal" onclick="personalAcc()"><span>Personal account </span>
</div>
<div>
<input type="checkbox" class="checkbox-round" id="bussiness" onclick="bussinessAcc()"><span>Bussiness account</span><i class="fas fa-exclamation-circle"></i>
</div>
</div>
<div id="container"></div>
</div>
</body>
</html>
<script>
var container = document.getElementById("container")
window.addEventListener('load', (event) => {
personalAcc();
});
function personalAcc()
{
document.getElementById("bussiness").style.backgroundColor = "white";
document.getElementById("personal").style.backgroundColor = "#439EE3";
container.innerHTML = null;
let mainDiv = document.createElement("div")
let fstName = document.createElement("input");
fstName.setAttribute("class", "smallInput");
fstName.placeholder = "Name";
fstName.setAttribute("id", "fName");
let lstName = document.createElement("input");
lstName.setAttribute("class", "smallInput");
lstName.placeholder = "email";
lstName.setAttribute("id", "lName");
let email = document.createElement("input")
email.setAttribute("class", "longInput");
email.placeholder = "username";
email.setAttribute("id", "email");
let Mobile = document.createElement("input")
Mobile.setAttribute("class", "longInput");
Mobile.placeholder = "Mobile";
Mobile.setAttribute("id", "mobile");
let passDiv = document.createElement("div")
let password = document.createElement("input")
password.setAttribute("class", "longInput");
password.setAttribute("id", "pass");
password.setAttribute("type", "password")
password.placeholder = "Password";
let toggle = document.createElement("input")
let passMsg = document.createElement("span");
passMsg.innerHTML = "Show"
toggle.setAttribute("type", "checkBox");
toggle.setAttribute("id", "toggle")
toggle.onclick = function()
{
if (password.type === "password") {
password.type = "text";
}
else
{
password.type = "password";
}
};
passDiv.append(password, toggle, passMsg);
let p = document.createElement("p")
p.textContent = "By clicking Register, you agree that you have read and accepted";
colorText = document.createElement("span")
colorText.innerHTML = " our User Agreement. User Privacy Notice. Rules and Policies"
colorText.style.color = "blue"
let btn = document.createElement("button");
btn.innerHTML = "Register"
btn.addEventListener("click", async function Register(){
let signup_data = {
name : document.getElementById("fName").value,
email : document.getElementById("lName").value,
password : document.getElementById("pass").value,
username: document.getElementById("email").value,
mobile: document.getElementById("mobile").value,
description: "Description",
}
signup_data = JSON.stringify(signup_data);
console.log(signup_data);
let api_url = `https://masai-api-mocker.herokuapp.com/auth/register`;
let res = await fetch(api_url, {
method:"POST",
body: signup_data,
headers: {
"Content-Type" : "application/json",
},
});
let data = await res.json();
console.log(data);
alert("Signup is successful! Do you want to Login ?" );
window.location.href = "signin.html";
});
mainDiv.append(fstName, lstName, email, Mobile, passDiv, p, colorText, btn);
container.append(mainDiv);
}
function bussinessAcc()
{
document.getElementById("personal").style.backgroundColor = "white";
document.getElementById("bussiness").style.backgroundColor = "#439EE3";
container.innerHTML = null;
let mainDiv = document.createElement("div")
let bussinessName = document.createElement("input");
bussinessName.setAttribute("class", "longInput");
bussinessName.placeholder = "Bussiness name";
let bussinessEmail = document.createElement("input");
bussinessEmail.setAttribute("class", "longInput");
bussinessEmail.placeholder = "bussiness email";
let passDiv = document.createElement("div")
let password = document.createElement("input")
password.setAttribute("class", "longInput");
password.setAttribute("id", "pass");
password.setAttribute("type", "password")
password.placeholder = "Password";
let toggle = document.createElement("input")
let passMsg = document.createElement("span");
passMsg.innerHTML = "Show"
toggle.setAttribute("type", "checkBox");
toggle.setAttribute("id", "toggle")
toggle.onclick = function()
{
if (password.type === "password") {
password.type = "text";
}
else
{
password.type = "password";
}
};
passDiv.append(password, toggle, passMsg);
let location = document.createElement("input")
location.setAttribute("class", "longInput");
location.placeholder = "Bussiness location";
let p1 = document.createElement("p")
p1.textContent = "if you dont't have a legal bussiness, enter country of residence."
let check = document.createElement("input")
check.setAttribute("type", "checkbox")
let span = document.createElement("span")
span.textContent = "I only want to buy on ebay. i dont't want to sell."
let p = document.createElement("p")
p.textContent = "By creating an account, you agree that you have read and accepted our User Agreement.User Privacy Notice. Rules and Policies";
let btn = document.createElement("button")
btn.innerHTML = "Register"
// btn.addEventListener("click", register)
// {
// //write a func and and pass values...
// }
mainDiv.append(bussinessName, bussinessEmail, passDiv, location, p1, check, span, p, btn)
container.append(mainDiv);
}
// api link : https://masai-api-mocker.herokuapp.com
// register link : https://masai-api-mocker.herokuapp.com/auth/resgister
/*
async function Register(){
//1. get all the input values
//2. store it in an object variable
//3. convert the object to Json
//4. send data to server(fetch)
let signup_data = {
fName : document.getElementById("fName").value,
lName : document.getElementById("lName").value,
email : document.getElementById("email").value,
password : document.getElementById("pass").value,
username: "",
mobile: "",
description: "",
}
signup_data = JSON.stringify(signup_data);
console.log(signup_data);
let api = `https://masai-api-mocker.herokuapp.com/auth/register`;
let res = await fetch(api, {
method:"POST",
body: signup_data,
// more extra information about my request
headers: {
"Content-Type" : "application/json",
},
});
let data = await res.json();
console.log(data);
} */
</script>