-
Notifications
You must be signed in to change notification settings - Fork 279
/
up.html
977 lines (840 loc) · 36.4 KB
/
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
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
<!-- <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Register & Login</title>
<link rel="stylesheet" href="src/css/up.css" />
<link rel="shortcut icon" href="ambulance.png" type="image/x-icon">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" />
</head>
<body>
<link rel="stylesheet" href="preloaderStyle.css">
<link rel="stylesheet" href="src/css/up.css" />
<link rel="shortcut icon" href="ambulance.png" type="image/x-icon" />
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"
/>
</head>
<div class="gtranslate_wrapper"></div>
<script>window.gtranslateSettings = {"default_language":"en","detect_browser_language":true,"wrapper_selector":".gtranslate_wrapper"}</script>
<script src="https://cdn.gtranslate.net/widgets/latest/float.js" defer></script>
<body>
preloader
<div id="preloader">
<div class="wrapper">
<div class="box-wrap">
<div class="box one"></div>
<div class="box two"></div>
<div class="box three"></div>
<div class="box four"></div>
<div class="box five"></div>
<div class="box six"></div>
</div>
</div>
</div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="container">
<div class="forms-container">
<div class="signin-signup">
<form action="#" class="sign-in-form">
<h2 class="title">Sign in</h2>
<div class="input-field">
<i class="fas fa-user"></i>
<input type="text" placeholder="Username" />
</div>
<div class="input-field">
<i class="fas fa-lock" id="toggle-password"></i>
<input type="password" placeholder="Password" id="password-input" />
</div>
<input type="submit" value="Login" class="btn solid" />
<p class="social-text">Or Sign in with social platforms</p>
<div class="social-media">
<a href="https://www.google.com" target="_blank" class="social-icon">
<i class="fab fa-google" style="font-size: 24px; color: #4285F4;"></i>
</a>
<a href="https://facebook.com/YourPage" target="_blank" class="social-icon">
<i class="fab fa-facebook-f" style="font-size: 24px; color: #4267B2;"></i>
</a>
<a href="https://github.com/YourGitHubProfile" target="_blank" class="social-icon">
<i class="fab fa-github" style="font-size: 24px; color: #333;"></i>
</a>
</div>
</form>
<form action="#" class="sign-up-form">
<h2 class="title">Sign up</h2>
<div class="input-field">
<i class="fas fa-user"></i>
<input type="text" placeholder="Username" />
</div>
<div class="input-field">
<i class="fas fa-envelope"></i>
<input type="email" placeholder="Email" />
</div>
<div class="input-field">
<i class="fas fa-lock" id="toggle-password-signup"></i>
<input type="password" placeholder="Password" id="password-input-signup" />
</div>
Strong password recommendations
<div class="password-recommendations">
<small style="color: red;">* Password must be at least 8 characters long, contain at least one uppercase letter, one lowercase letter, one number, and one special character.</small>
</div>
<input type="submit" class="btn" value="Sign up" />
<p class="social-text">Or Sign up with social platforms</p>
<div class="social-media">
<a href="https://www.google.com" target="_blank" class="social-icon">
<i class="fab fa-google" style="font-size: 24px; color: #4285F4;"></i>
</a>
<a href="https://facebook.com/YourPage" target="_blank" class="social-icon">
<i class="fab fa-facebook-f" style="font-size: 24px; color: #4267B2;"></i>
</a>
<a href="https://github.com/YourGitHubProfile" target="_blank" class="social-icon">
<i class="fab fa-github" style="font-size: 24px; color: #333;"></i>
</a>
</div>
</form>
</div>
<div class="input-field">
<i class="fas fa-lock" id="toggle-password"></i>
<input
type="password"
placeholder="Password"
id="password-input"
/>
</div>
<input type="submit" value="Login" class="btn solid" />
<p class="social-text">Or Sign in with social platforms</p>
<div class="social-media">
<a
href="https://www.google.com"
target="_blank"
class="social-icon"
>
<i
class="fab fa-google"
style="font-size: 24px; color: #4285f4"
></i>
</a>
<a
href="https://facebook.com/YourPage"
target="_blank"
class="social-icon"
>
<i
class="fab fa-facebook-f"
style="font-size: 24px; color: #4267b2"
></i>
</a>
<div class="forms-container">
<div class="signin-signup">
<form action="#" class="sign-in-form">
<h2 class="title">Sign in</h2>
<div class="input-field">
<i class="fas fa-user"></i>
<input type="text" placeholder="Username" />
</div>
<div class="input-field">
<i class="fas fa-lock" id="toggle-password"></i>
<input
type="password"
placeholder="Password"
id="password-input"
/>
</div>
<input type="submit" value="Login" class="btn solid" />
<p class="social-text">Or Sign in with social platforms</p>
<div class="social-media">
<a
href="https://www.google.com"
target="_blank"
class="social-icon"
>
<i
class="fab fa-google"
style="font-size: 24px; color: #4285f4"
>
</i>
</a>
<a
href="https://facebook.com/YourPage"
target="_blank"
class="social-icon"
>
<i
class="fab fa-facebook-f"
style="font-size: 24px; color: #4267b2"
>
</i>
</a>
<a
href="https://github.com/YourGitHubProfile"
target="_blank"
class="social-icon"
>
<i
class="fab fa-github"
style="font-size: 24px; color: #333"
></i>
</a>
</div>
</form>
<form action="#" class="sign-up-form">
<h2 class="title">Sign up</h2>
<div class="input-field">
<i class="fas fa-user"></i>
<input type="text" placeholder="Username" />
</div>
<div class="input-field">
<i class="fas fa-envelope"></i>
<input type="email" placeholder="Email" />
</div>
<div class="input-field">
<i class="fas fa-lock" id="toggle-password-signup"></i>
<input
type="password"
placeholder="Password"
id="password-input-signup"
/>
</div>
<input type="submit" class="btn" value="Sign up" />
<p class="social-text">Or Sign up with social platforms</p>
<div class="social-media">
<a
href="https://www.google.com"
target="_blank"
class="social-icon"
>
<i
class="fab fa-google"
style="font-size: 24px; color: #4285f4"
></i>
</a>
<a
href="https://facebook.com/YourPage"
target="_blank"
class="social-icon"
>
<i
class="fab fa-facebook-f"
style="font-size: 24px; color: #4267b2"
></i>
</a>
<a
href="https://github.com/YourGitHubProfile"
target="_blank"
class="social-icon"
>
<i
class="fab fa-github"
style="font-size: 24px; color: #333"
></i>
</a>
</div>
</form>
</div>
<div class="panels-container">
<a href="index.html" class="homeBtn">
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 20"
width="30"
height="30"
>
<path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z" />
</svg>
</a>
<div class="panel left-panel">
<div class="content">
<h3>New here ?</h3>
<p>
Discover new experiences with AmbuFlow! <br />Get access to
exclusive content and features. <br />
Create your account.
</p>
<a href="index.html" class="homeBtn">
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox=" 0 0 24 20"
width="30"
height="30"
>
<path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z" />
</svg>
</a>
<button class="btn transparent" id="sign-up-btn">Sign up</button>
</div>
<img src="img/log.svg" class="image" alt="" />
</div>
<div class="panel right-panel">
<div class="content">
<h3>One of us ?</h3>
<p>
Welcome to our community
</p>
<button class="btn transparent" id="sign-in-btn">
Sign in
</button>
<p>Welcome to our community</p>
<button class="btn transparent" id="sign-in-btn">Sign in</button>
</div>
<img src="img/register.svg" class="image" alt="" />
</div>
</div>
</div>
<script src="preloader.js"></script>
<script>
const sign_in_btn = document.querySelector("#sign-in-btn");
const sign_up_btn = document.querySelector("#sign-up-btn");
const container = document.querySelector(".container");
// Add sign-up-mode class to container by default
container.classList.add("sign-up-mode");
sign_up_btn.addEventListener("click", () => {
container.classList.add("sign-up-mode");
});
sign_in_btn.addEventListener("click", () => {
container.classList.remove("sign-up-mode");
});
// Sign in form submission
document.querySelector(".sign-in-form").addEventListener('submit', function(event) {
event.preventDefault();
// Get the input values
const username = document.querySelector(".sign-in-form input[type='text']").value;
const password = document.querySelector(".sign-in-form input[type='password']").value;
// Dummy login logic for demo purposes
if (username === 'admin' && password === 'password') {
alert('Login successful!');
// Redirect to dashboard page
window.location.href = 'index.html';
} else {
alert('Invalid username or password');
}
});
// Sign up form submission
document.querySelector(".sign-up-form").addEventListener('submit', function(event) {
const sign_in_btn = document.querySelector("#sign-in-btn");
const sign_up_btn = document.querySelector("#sign-up-btn");
const container = document.querySelector(".container");
// Add sign-up-mode class to container by default
container.classList.add("sign-up-mode");
sign_up_btn.addEventListener("click", () => {
container.classList.add("sign-up-mode");
});
sign_in_btn.addEventListener("click", () => {
container.classList.remove("sign-up-mode");
});
// Sign in form submission
document.querySelector(".sign-in-form").addEventListener("submit", async function (event) {
event.preventDefault();
const username = document.querySelector(".sign-in-form input[type='text']").value;
const password = document.querySelector(".sign-in-form input[type='password']").value;
// Remove the below block of code when the server is ready (Written just for testing)
if (username === "username" && password === "123456") {
console.log("Login successful!");
localStorage.setItem("JWTtoken", "dummyToken123"); // Example token
localStorage.setItem('userID', "test387398393")
localStorage.setItem("login", "success");
window.location.href = "hospital.html";
}
// Testing block ends here, proceed with actual request once the server is ready
const data = JSON.stringify({ username, password });
console.log(data);
// Uncomment the below code when MongoDB is ready
/*
try {
const response = await fetch("http://localhost:3000/login", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: data,
});
if (!response.ok) {
throw new Error("Login failed: " + response.statusText);
}
const result = await response.json();
console.log("Server response:", result);
localStorage.setItem("token", result.token);
console.log('Login successful!');
window.location.href = "hospital.html";
} catch (error) {
alert("Invalid username or password");
console.error("Error during login:", error);
}
*/
});
// Sign up form submission
document.querySelector(".sign-up-form").addEventListener("submit", async function (event) {
event.preventDefault();
// Get the input values
const username = document.querySelector(".sign-up-form input[type='text']").value;
const email = document.querySelector(".sign-up-form input[type='email']").value;
const password = document.querySelector(".sign-up-form input[type='password']").value;
if (username === '' || email === '' || password === '') {
alert('Please fill in all fields');
return;
}
// Dummy signup logic for demo purposes
localStorage.setItem('username', username);
localStorage.setItem('email', email);
localStorage.setItem('password', password);
localStorage.setItem('isLoggedIn', 'true');
// Custom success message
alert('Your account is created successfully. Please login to access the website.');
// Redirect to dashboard page
window.location.href = 'index.html';
});
// Toggle password visibility
function togglePassword(fieldId, icon) {
const field = document.getElementById(fieldId);
const isPassword = field.type === 'password';
// Toggle between 'password' and 'text'
field.type = isPassword ? 'text' : 'password';
// Change the icon class between eye and eye-slash
icon.classList.toggle('fa-lock-open', isPassword);
icon.classList.toggle('fa-lock', !isPassword);
}
document.getElementById("toggle-password").addEventListener("click", function() {
togglePassword("password-input", this);
});
document.getElementById("toggle-password-signup").addEventListener("click", function() {
togglePassword("password-input-signup", this);
});
// Check password strength
function checkPasswordStrength() {
const password = document.querySelector(".sign-up-form input[type='password']").value;
const strengthWeak = document.getElementById('strength-weak');
const strengthMedium = document.getElementById('strength-medium');
const strengthStrong = document.getElementById('strength-strong');
let strength = 0;
if (password.length >= 8) strength++;
if (password.match(/[A-Z]/)) strength++;
if (password.match(/[a-z]/)) strength++;
if (password.match(/[0-9]/)) strength++;
if (password.match(/[^a-zA-Z0-9]/)) strength++;
strengthWeak.style.display = strength >= 1 ? 'block' : 'none';
strengthMedium.style.display = strength === 2 ? 'block' : 'none';
strengthStrong.style.display = strength === 3 ? 'block' : 'none';
}
// Add event listener for password input field to check strength
document.querySelector(".sign-up-form input[type='password']").addEventListener('input', checkPasswordStrength);
</script>
// Validate inputs
if (username === "" || email === "" || password === "") {
alert("Please fill in all fields");
return;
}
// Generate a UUID
const userId = uuid.v4();
console.log("Generated UUID:", userId);
const data = JSON.stringify({
id: userId,
username,
email,
password,
});
console.log(data);
// Uncomment the below code when MongoDB is ready
/*
try {
const response = await fetch("http://localhost:3000/signup", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: data,
});
if (!response.ok) {
const errorData = await response.json();
throw new Error(errorData.message || "Signup failed");
}
const result = await response.json();
console.log("Server response:", result);
alert("Signup successful!");
window.location.href = "login.html";
} catch (error) {
alert(error.message);
console.error("Error during signup:", error);
}
*/
});
// Toggle password visibility
function togglePassword(fieldId, icon) {
const field = document.getElementById(fieldId);
const isPassword = field.type === "password";
// Toggle between 'password' and 'text'
field.type = isPassword ? "text" : "password";
// Change the icon class between eye and eye-slash
icon.classList.toggle("fa-lock-open", isPassword);
icon.classList.toggle("fa-lock", !isPassword);
}
document
.getElementById("toggle-password")
.addEventListener("click", function () {
togglePassword("password-input", this);
});
document
.getElementById("toggle-password-signup")
.addEventListener("click", function () {
togglePassword("password-input-signup", this);
});
// Check password strength
function checkPasswordStrength() {
const password = document.querySelector(
".sign-up-form input[type='password']"
).value;
const strengthWeak = document.getElementById("strength-weak");
const strengthMedium = document.getElementById("strength-medium");
const strengthStrong = document.getElementById("strength-strong");
let strength = 0;
if (password.length >= 8) strength++;
if (password.match(/[A-Z]/)) strength++;
if (password.match(/[a-z]/)) strength++;
if (password.match(/[0-9]/)) strength++;
if (password.match(/[^a-zA-Z0-9]/)) strength++;
strengthWeak.className = "";
strengthMedium.className = "";
strengthStrong.className = "";
if (strength >= 1) strengthWeak.className = "weak";
if (strength >= 3) strengthMedium.className = "medium";
if (strength >= 5) strengthStrong.className = "strong";
}
document
.querySelector(".sign-up-form input[type='password']")
.addEventListener("input", checkPasswordStrength);
</script>
<script>
const coords = { x: 0, y: 0 };
const circles = document.querySelectorAll(".circle");
const colors = [
"#ffb56b",
"#fdaf69",
"#f89d63",
"#f59761",
"#ef865e",
"#ec805d",
"#e36e5c",
"#df685c",
"#d5585c",
"#d1525c",
"#c5415d",
"#c03b5d",
"#b22c5e",
"#ac265e",
"#9c155f",
"#950f5f",
"#830060",
"#7c0060",
"#680060",
"#60005f",
"#48005f",
"#3d005e",
];
circles.forEach(function (circle, index) {
circle.x = 0;
circle.y = 0;
circle.style.backgroundColor = colors[index % colors.length];
});
window.addEventListener("mousemove", function (e) {
coords.x = e.clientX;
coords.y = e.clientY;
});
function animateCircles() {
let x = coords.x;
let y = coords.y;
circles.forEach(function (circle, index) {
circle.style.left = x - 12 + "px";
circle.style.top = y - 12 + "px";
circle.style.scale = (circles.length - index) / circles.length;
circle.x = x;
circle.y = y;
const nextCircle = circles[index + 1] || circles[0];
x += (nextCircle.x - x) * 0.3;
y += (nextCircle.y - y) * 0.3;
});
requestAnimationFrame(animateCircles);
}
animateCircles();
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/uuid/8.3.2/uuid.min.js"></script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Register & Login</title>
<link rel="stylesheet" href="preloaderStyle.css">
<link rel="stylesheet" href="src/css/up.css" />
<link rel="shortcut icon" href="ambulance.png" type="image/x-icon" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" />
</head>
<body>
<div class="gtranslate_wrapper"></div>
<script>
window.gtranslateSettings = {
"default_language": "en",
"detect_browser_language": true,
"wrapper_selector": ".gtranslate_wrapper"
};
</script>
<script src="https://cdn.gtranslate.net/widgets/latest/float.js" defer></script>
<!-- Preloader -->
<div id="preloader">
<div class="wrapper">
<div class="box-wrap">
<div class="box one"></div>
<div class="box two"></div>
<div class="box three"></div>
<div class="box four"></div>
<div class="box five"></div>
<div class="box six"></div>
</div>
</div>
</div>
<div class="container">
<div class="forms-container">
<div class="signin-signup">
<!-- Sign In Form -->
<form class="sign-in-form" id="signInForm">
<h2 class="title">Sign in</h2>
<div class="input-field">
<i class="fas fa-user"></i>
<input type="text" placeholder="Username" required />
</div>
<div class="input-field">
<i class="fas fa-lock" id="toggle-password"></i>
<input type="password" placeholder="Password" id="password-input" required />
</div>
<input type="submit" value="Login" class="btn solid" />
<p class="social-text">Or Sign in with social platforms</p>
<div class="social-media">
<a href="#" class="social-icon" onclick="socialLogin('google')"><i class="fab fa-google" style="font-size: 24px; color: #4285f4"></i></a>
<a href="#" class="social-icon" onclick="socialLogin('facebook')"><i class="fab fa-facebook-f" style="font-size: 24px; color: #4267b2"></i></a>
<a href="#" class="social-icon" onclick="socialLogin('github')"><i class="fab fa-github" style="font-size: 24px; color: #333"></i></a>
</div>
</form>
<!-- Sign Up Form -->
<form class="sign-up-form" id="signUpForm">
<h2 class="title">Sign up</h2>
<div class="input-field">
<i class="fas fa-user"></i>
<input type="text" placeholder="Username" required />
</div>
<div class="input-field">
<i class="fas fa-envelope"></i>
<input type="email" placeholder="Email" required />
</div>
<div class="input-field">
<i class="fas fa-lock" id="toggle-password-signup"></i>
<input type="password" placeholder="Password" id="password-input-signup" required />
</div>
<input type="submit" class="btn" value="Sign up" />
</form>
</div>
</div>
<div class="panels-container">
<div class="panel left-panel">
<div class="content">
<h3>New here?</h3>
<p>Discover new experiences with AmbuFlow! <br />Get access to exclusive content and features. <br />Create your account.</p>
<button class="btn transparent" id="sign-up-btn">Sign up</button>
</div>
</div>
<div class="panel right-panel">
<div class="content">
<h3>One of us?</h3>
<p>Welcome to our community</p>
<button class="btn transparent" id="sign-in-btn">Sign in</button>
</div>
</div>
</div>
</div>
<script src="preloader.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/uuid/8.3.2/uuid.min.js"></script>
<script>
const sign_in_btn = document.querySelector("#sign-in-btn");
const sign_up_btn = document.querySelector("#sign-up-btn");
const container = document.querySelector(".container");
// Toggle between sign up and sign in
sign_up_btn.addEventListener("click", () => {
container.classList.add("sign-up-mode");
});
</script>
<script>
sign_in_btn = document.querySelector("#sign-in-btn");
sign_up_btn = document.querySelector("#sign-up-btn");
container = document.querySelector(".container");
sign_in_btn.addEventListener("click", () => {
container.classList.remove("sign-up-mode");
});
// Sign in form submission
document.getElementById("signInForm").addEventListener('submit', function (event) {
event.preventDefault();
const username = this.querySelector("input[type='text']").value;
const password = this.querySelector("input[type='password']").value;
// Retrieve stored credentials
const storedUsername = localStorage.getItem('username');
const storedPassword = localStorage.getItem('password');
// Validate input against stored credentials
if (username === storedUsername && password === storedPassword) {
alert('Login successful!');
window.location.href = 'index.html'; // Redirect to homepage after successful login
} else {
alert('Invalid username or password');
}
});
// Sign up form submission
document.getElementById("signUpForm").addEventListener('submit', function (event) {
event.preventDefault();
const username = this.querySelector("input[type='text']").value;
const email = this.querySelector("input[type='email']").value;
const password = this.querySelector("input[type='password']").value;
if (username === '' || email === '' || password === '') {
alert('Please fill in all fields');
return;
}
username = document.querySelector(".sign-in-form input[type='text']").value;
password = document.querySelector(".sign-in-form input[type='password']").value;
// Retrieve stored credentials
storedUsername = localStorage.getItem('username');
storedPassword = localStorage.getItem('password');
// Store the username and password in localStorage
localStorage.setItem('username', username);
localStorage.setItem('password', password);
alert('Your account is created successfully. Please login to access the website.');
container.classList.remove("sign-up-mode"); // Switch to sign in mode
});
// Social media authentication (Dummy function for demo purposes)
function socialLogin(platform) {
// Here you would typically initiate the OAuth process for the given platform
switch (platform) {
case 'google':
alert('Successfully login with Google..');
window.location.href = 'index.html';
// Add your Google OAuth logic here
break;
case 'facebook':
alert('Successfully login with Facebook...');
window.location.href = 'index.html';
// Add your Facebook OAuth logic here
break;
case 'github':
alert('Successfully login with GitHub...');
window.location.href = 'index.html';
// Add your GitHub OAuth logic here
break;
default:
alert('Unknown platform');
break;
}
}
// Toggle password visibility
function togglePassword(fieldId, icon) {
const field = document.getElementById(fieldId);
field.type = field.type === 'password' ? 'text' : 'password';
icon.classList.toggle('fa-lock-open');
icon.classList.toggle('fa-lock');
}
username = document.querySelector(".sign-up-form input[type='text']").value;
email = document.querySelector(".sign-up-form input[type='email']").value;
password = document.querySelector(".sign-up-form input[type='password']").value;
document.getElementById("toggle-password").addEventListener("click", function () {
togglePassword("password-input", this);
});
document.getElementById("toggle-password-signup").addEventListener("click", function () {
togglePassword("password-input-signup", this);
});
// Circle animation
const coords = { x: 0, y: 0 };
const circles = document.querySelectorAll(".circle");
const colors = [
"#ffb56b", "#fdaf69", "#f89d63", "#f59761", "#ef865e",
"#ec805d", "#e36e5c", "#df685c", "#d5585c", "#d1525c",
"#c5415d", "#c03b5d", "#b22c5e", "#ac265e", "#9c155f",
"#950f5f", "#830060", "#7c0060", "#680060", "#60005f",
"#48005f", "#3d005e",
];
// Set up circle colors and positions
circles.forEach(function (circle, index) {
circle.x = 0;
circle.y = 0;
circle.style.backgroundColor = colors[index % colors.length];
});
// Track mouse movement
window.addEventListener("mousemove", function (e) {
coords.x = e.clientX;
coords.y = e.clientY;
});
// Animate circles based on mouse position
function animateCircles() {
// Toggle password visibility
function togglePassword(fieldId, icon) {
field = document.getElementById(fieldId);
field.type = field.type === 'password' ? 'text' : 'password';
icon.classList.toggle('fa-lock-open');
icon.classList.toggle('fa-lock');
}
document.getElementById("toggle-password").addEventListener("click", function () {
togglePassword("password-input", this);
});
document.getElementById("toggle-password-signup").addEventListener("click", function () {
togglePassword("password-input-signup", this);
});
// Circle animation
coords = { x: 0, y: 0 };
circles = document.querySelectorAll(".circle");
colors = [
"#ffb56b", "#fdaf69", "#f89d63", "#f59761", "#ef865e",
"#ec805d", "#e36e5c", "#df685c", "#d5585c", "#d1525c",
"#c5415d", "#c03b5d", "#b22c5e", "#ac265e", "#9c155f",
"#950f5f", "#830060", "#7c0060", "#680060", "#60005f",
"#48005f", "#3d005e",
];
circles.forEach(function (circle, index) {
circle.x = 0;
circle.y = 0;
circle.style.backgroundColor = colors[index % colors.length];
});
window.addEventListener("mousemove", function (e) {
coords.x = e.clientX;
coords.y = e.clientY;
});
function animateCircles() {
let x = coords.x;
let y = coords.y;
circles.forEach(function (circle, index) {
circle.style.left = x - 12 + "px";
circle.style.top = y - 12 + "px";
circle.style.scale = (circles.length - index) / circles.length;
circle.x = x;
circle.y = y;
nextCircle = circles[index + 1] || circles[0];
x += (nextCircle.x - x) * 0.3;
y += (nextCircle.y - y) * 0.3;
});
requestAnimationFrame(animateCircles);
}
animateCircles();
</script>
</body>
</html>