-
Notifications
You must be signed in to change notification settings - Fork 1
/
sign-up.html
324 lines (304 loc) · 11.8 KB
/
sign-up.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
311
312
313
314
315
316
317
318
319
320
321
322
323
324
<!DOCTYPE html>
<html lang="en">
<head>
<title>SignUp</title>
<meta property="og:title" content="SignUp" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta charset="utf-8" />
<meta property="twitter:card" content="summary_large_image" />
<style>
html { line-height: 1.15;}body { margin: 0;}* { box-sizing: border-box; border-width: 0; border-style: solid;}p,li,ul,pre,div,h1,h2,h3,h4,h5,h6 { margin: 0; padding: 0;}button,input,optgroup,select,textarea { font-family: inherit; font-size: 100%; line-height: 1.15; margin: 0;}button,select { text-transform: none;}button,[type="button"],[type="reset"],[type="submit"] { -webkit-appearance: button;}button::-moz-focus-inner,[type="button"]::-moz-focus-inner,[type="reset"]::-moz-focus-inner,[type="submit"]::-moz-focus-inner { border-style: none; padding: 0;}button:-moz-focus,[type="button"]:-moz-focus,[type="reset"]:-moz-focus,[type="submit"]:-moz-focus { outline: 1px dotted ButtonText;}a { color: inherit; text-decoration: inherit;}input { padding: 2px 4px;}img { display: block;}
</style>
<style>
html {
font-family: Montserrat;
font-size: 16px;
}
body {
font-weight: 400;
font-style:normal;
text-decoration: none;
text-transform: none;
letter-spacing: normal;
line-height: 1.1;
color: var(--dl-color-grays-dark100);
background-color: var(--dl-color-grays-white100);
}
</style>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap"
/>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Lexend:wght@100;200;300;400;500;600;700;800;900&display=swap"
/>
<style>
::placeholder{
color: #63667066;
}
</style>
<link rel="stylesheet" href="./style.css" />
</head>
<body>
<div>
<link href="./sign-up.css" rel="stylesheet" />
<div class="sign-up-container">
<img
alt="image"
src="public/playground_assets/unsplash_pgdw_bhdbpi-1100h.png"
class="sign-up-image"
/>
<div class="sign-up-content-container">
<a href="sign-in.html" class="sign-up-navlink">
Sign In
</a>
<h1 class="sign-up-text02"><span>Sign Up with</span></h1>
<div class="sign-up-container01">
<img
alt="image"
src="public/playground_assets/group%2024-1000h.png"
class="sign-up-image1"
/>
<img
alt="image"
src="public/playground_assets/group%2023-1000h.png"
class="sign-up-image2"
/>
</div>
<span class="sign-up-text04 content-Light">OR</span>
<div class="sign-up-input-container">
<!-- <label class="sign-up-text05">I'm a</label> -->
<!-- <div class="sign-up-container02 input">
<button class="sign-up-button button-primary button">
Student
</button>
<button class="sign-up-button1 button-primary button">
College
</button>
</div> -->
<div class="sign-up-container03">
<label class="sign-up-text06">Name</label>
<div class="sign-up-container04 input">
<input id="nameInp"
type="text"
placeholder="Name"
class="sign-up-textinput input"
/>
</div>
</div>
<div class="sign-up-container05">
<label class="sign-up-text07">Email</label>
<div class="sign-up-container06 input">
<input id="emailInp"
type="text"
placeholder="Email"
class="sign-up-textinput1 input"
/>
</div>
</div>
<div class="sign-up-container05">
<label class="sign-up-text07">Username</label>
<div class="sign-up-container06 input">
<input id="userInp"
type="text"
placeholder="Username"
class="sign-up-textinput1 input"
/>
</div>
</div>
<div class="sign-up-container05">
<label class="sign-up-text07">I'm a</label>
<div class="sign-up-container06 input">
<select id="cs" class="form-control mb-3 me">
<option value="clg">College</option>
<option value="stu">Student</option>
</select>
</div>
</div>
<div class="sign-up-container07">
<label class="sign-up-text08">Password</label>
<div class="sign-up-container08 input">
<input id="passInp"
type="text"
placeholder="6+ characters"
class="sign-up-textinput2 input"
/>
</div>
</div>
<label class="sign-up-text09">
<span class="sign-up-text10">
Creating an account means you’re okay with our
</span>
<span class="sign-up-text11">Terms of uses, Privacy Policy.</span>
</label>
</div>
<button id="sub_btn" class="sign-up-button2 button-primary button">Sign Up</button>
</div>
<a href="index.html" class="sign-up-navlink1">
<img
alt="image"
src="public/playground_assets/group%2019-1500w.png"
class="sign-up-image3"
/>
</a>
<div class="sign-up-container09">
<span class="sign-up-text12">
<span>Learn</span>
<br />
<span>Build</span>
<br />
<span>Collaborate</span>
</span>
<span class="sign-up-text18">
<span>Confused in finding the right project or knowledge,</span>
<br />
<span>not anymore, Find all information here.</span>
</span>
</div>
</div>
</div>
<script src="https://unpkg.com/@teleporthq/teleport-custom-scripts"></script>
<script type="module">
window.onload = () => {
const runAllScripts = () => {
initializeAllSliders();
};
const listenForUrlChanges = () => {
let url = location.href;
document.body.addEventListener(
"click",
() => {
requestAnimationFrame(() => {
if (url !== location.href) {
runAllScripts();
url = location.href;
}
});
},
true
);
};
const initializeAllSliders = () => {
const allSliders = document.querySelectorAll('[data-type="slider"]');
allSliders.forEach((carrousel) => {
initializeSlider(carrousel);
});
};
const initializeSlider = (carrousel) => {
let currentSlide = 0;
const slides = carrousel.querySelectorAll('[data-type="slide"]');
const nextSlideBtns = carrousel.querySelectorAll(
'[data-action="nextSlide"]'
);
const previousSlideBtns = carrousel.querySelectorAll(
'[data-action="previousSlide"]'
);
const changeSlide = (slideIndex, action) => {
currentSlide = slideIndex;
switch (action) {
case "next":
slideIndex === slides.length - 1
? (currentSlide = 0)
: currentSlide++;
break;
case "previous":
slideIndex === 0
? (currentSlide = slides.length - 1)
: currentSlide--;
}
carrousel.style.transform = `translateX(${-100 * currentSlide}%)`;
};
previousSlideBtns.forEach((btn) => {
btn.addEventListener("click", () =>
changeSlide(currentSlide, "previous")
);
});
nextSlideBtns.forEach((btn) => {
btn.addEventListener("click", () =>
changeSlide(currentSlide, "next")
);
});
};
runAllScripts();
};
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.6.7/firebase-app.js";
const firebaseConfig = {
apiKey: "AIzaSyAvQC-luCdU85VGMDSlpSVKi6RvC3CsgMo",
authDomain: "register-291c8.firebaseapp.com",
databaseURL: "https://register-291c8-default-rtdb.firebaseio.com",
projectId: "register-291c8",
storageBucket: "register-291c8.appspot.com",
messagingSenderId: "479424213049",
appId: "1:479424213049:web:57bdc11e6a6c8057e5dde8"
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
import{getDatabase,ref,set,child,get}
from "https://www.gstatic.com/firebasejs/9.6.7/firebase-database.js";
const db=getDatabase();
const name=document.getElementById('nameInp');
const email=document.getElementById('emailInp');
const username=document.getElementById('userInp');
const pass=document.getElementById('passInp');
const submit=document.getElementById('sub_btn');
const category=document.getElementById('cs');
function isEmptyOrSpaces(str){
return str==null || str.match(/^ *$/) !==null;
}
function Validation(){
let nameregex=/^[a-zA-Z\s]+$/;
let emailregex=/^[a-zA-Z0-9]+@(gmail|yahoo|outlook)\.com$/;
let userregex=/^[a-zA-Z0-9]{5,}$/;
if(isEmptyOrSpaces(name.value) || isEmptyOrSpaces(email.value) || isEmptyOrSpaces(username.value) || isEmptyOrSpaces(pass.value)){
alert("You cannot leave any field empty");
return false;
}
if(!nameregex.test(name.value)){
alert("The name should only contain alphabet");
return false;
}
if(!emailregex.test(email.value)){
alert("Enter a valid email");
return false;
}
if(!userregex.test(username.value)){
alert("-username can only be alphanumeric\n-username must be atleast 5 character\n-username cannot contain spaces");
return false;
}
return true;
}
function RegisterUser(){
if(!Validation()){
return;
};
const dbRef=ref(db);
get(child(dbRef,"UsersList/"+username.value)).then((snapshot)=>{
if(snapshot.exists()){
alert("Account Already Exist!");
}
else{
set(ref(db,"UsersList/"+username.value),{
fullname:name.value,
email:email.value,
username:username.value,
password:pass.value,
category:category.value
})
.then(()=>{
alert("User Added Successfully");
})
.catch((error)=>{
alert("error"+error);
})
}
})
}
// function encPass(){
// var pass12=CryptoJS.AES.encrypt(pass.value,pass.value);
// return pass12.toString();
// }
submit.addEventListener('click',RegisterUser);
</script>
</body>
</html>