-
Notifications
You must be signed in to change notification settings - Fork 350
/
auth.html
332 lines (287 loc) · 11 KB
/
auth.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
<!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="auth.css" />
<link rel="icon" href="/icons/airplane.svg" />
<link rel="icon" href="https://img.icons8.com/?size=100&id=48179&format=png&color=000000">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
/* circle styles */
.circle {
height: 24px;
width: 24px;
border-radius: 24px;
background-color: rgb(255, 0, 0);
position: fixed;
top: 0;
left: 0;
pointer-events: none;
z-index: 99999999;
}
</style>
</head>
<body>
<div class="container">
<div class="forms-container">
<div class="sign-in-signup">
<form action="#" class="sign-in-form" onsubmit="return validateSignInForm()">
<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"></i>
<input type="password" placeholder="Password" id="sign-in-password" />
<i class="fas fa-eye password-toggle" onclick="togglePassword('sign-in-password', this)"></i>
</div>
<div class="form-check d-flex">
<input type="checkbox" class="form-check-input" id="login-remember" />
<label class="form-check-label">Remember me</label>
</div>
<div class="login">
<input type="submit" value="Login" class="btn solid" />
</div>
<a href="/forgot_password.html" style="text-decoration: none; color: black;"><p>Forgot Password?</p></a>
<p class="social-text">OR<br>Sign in with social platforms</p>
<div class="social-media">
<button class="social-icon" id="microsoft-icon">
<img src="img/Microsoft_Logo.png" alt="Microsoft Icon" style="width: 25px; height: 25px;">
</button>
<button class="social-icon" id="google-icon">
<img src="./img/google.png" alt="Google Icon" style="width: 30px; height: 30px;">
</button>
<button class="social-icon" id="githubSignInBtn">
<i class="fab fa-github"></i>
</button>
</div>
</form>
<form action="#" class="sign-up-form" onsubmit="return validateForm()">
<h2 class="title">Sign up</h2>
<!-- Username Field -->
<div class="input-field">
<i class="fas fa-user"></i>
<input type="text" placeholder="Username" id="username" required />
</div>
<!-- Email Field -->
<div class="input-field">
<i class="fas fa-envelope"></i>
<input type="email" placeholder="Email" id="email" required />
</div>
<!-- Password Field -->
<div class="input-field">
<i class="fas fa-lock"></i>
<input type="password" placeholder="Password" id="signup-password" required />
<i class="fas fa-eye password-toggle" onclick="togglePassword('signup-password', this)"></i>
</div>
<!-- Password Strength Bars -->
<!-- <div class="password-strength">
<div id="strength-weak"></div>
<div id="strength-medium"></div>
<div id="strength-strong"></div>
</div> -->
<div class="form-check d-flex">
<input type="checkbox" class="form-check-input" id="login-remember" />
<label class="form-check-label">Remember me</label>
</div>
<input type="submit" class="btn" value="Sign up" />
</form>
<p id="error-message" style="color: red; display: none;"></p>
</div>
</div>
<script>
function validateForm() {
const password = document.getElementById('signup-password').value;
const email = document.getElementById('email').value;
const username = document.getElementById('username').value;
// Sign-up validation logic
if (password.length < 6) {
alert("Password must be at least 6 characters long.");
return false;
}
const hexRegex = /^(?=.*[A-Z])(?=.*\d)[A-Za-z\d]+$/;
if (!hexRegex.test(password)) {
alert("Password must contain at least one uppercase letter (A-Z), one number (0-9), and include only letters and numbers.");
return false;
}
if (username.trim() === "") {
alert("Please enter a valid username.");
return false;
}
if (!email.includes("@")) {
alert("Please enter a valid email address.");
return false;
}
// Show submission message in a pop-up
alert("Sign up successful! Welcome, " + username + "!");
// clear the form after submission
document.querySelector(".sign-up-form").reset();
}
function validateSignInForm() {
const username = document.querySelector('.sign-in-form input[type="text"]').value;
const password = document.querySelector('.sign-in-form input[type="password"]').value;
// Sign-in validation logic
if (username.trim() === "") {
alert("Please enter your username.");
return false;
}
if (password.trim() === "") {
alert("Please enter your password.");
return false;
}
// Simulate successful login
alert("You have successfully logged in to the website!");
// Redirect to the home screen after a short delay
setTimeout(function() {
window.location.href = "index.html";
}, 2000); // Redirect after 2 seconds
// If all validations pass, return true to allow form submission
return false; // Prevent form submission since we are handling the redirect
};
</script>
<div class="panels-container">
<div class="panel left-panel">
<div class="content">
<h3>New here ?</h3>
<p>
Discover new experiences with BuddyTrail! <br> Create your account.
</p>
<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 back 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>
<a href="index.html" class="homeBtn">
<i class="fas fa-home"></i>
</a>
<div id="toast-container"></div>
<script src="https://www.gstatic.com/firebasejs/9.18.0/firebase-app-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/9.18.0/firebase-auth-compat.js"></script>
<script src="firebase.js"></script>
<script>
const signUpBtn = document.getElementById('sign-up-btn');
const signInBtn = document.getElementById('sign-in-btn');
const container = document.querySelector('.container');
signUpBtn.addEventListener('click', () => {
container.classList.add('sign-up-mode');
});
signInBtn.addEventListener('click', () => {
container.classList.remove('sign-up-mode');
});
function togglePassword(id, element) {
const passwordInput = document.getElementById(id);
if (passwordInput.type === 'password') {
passwordInput.type = 'text';
element.classList.add('active');
} else {
passwordInput.type = 'password';
element.classList.remove('active');
}
}
</script>
<script type="module" src="auth.js" defer></script>
<script type="module" src="SignUpWithGoogle.js"></script>
<script type="module" src="SignIn-Up-withGithub.js"></script>
<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>
<!-- Circles -->
<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>
<script>
// coordinates for the cursor :
const coords = { x: 0, y: 0 };
const circles = document.querySelectorAll(".circle");
const colors = [
"#fc5720", "#fc6532", "#fc6532","#fd8b65", "#d5585c", "#fac3b1", "#f4d5cb", "#fefefe", "#fefefe", "#cdf2c5", "#b2eca5", "#95e283", "#7dda68", "#4adc2d", "#69d451", "#54c939", "#34b916", "#28b309", "#1e9c02",
];
circles.forEach(function (circle, index) {
circle.x = 0;
circle.y = 0;
circle.style.backgroundColor = colors[index % colors.length];
});
// update the coordinates when the mouse moves:
window.addEventListener("mousemove", function (e) {
coords.x = e.clientX;
coords.y = e.clientY;
});
// animation function to move the circles:
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>
<!-- Dash eye icon script -->
<script>
function togglePassword(id, element) {
const passwordInput = document.getElementById(id);
if (passwordInput.type === 'password') {
passwordInput.type = 'text';
element.classList.remove('fa-eye');
element.classList.add('fa-eye-slash');
} else {
passwordInput.type = 'password';
element.classList.remove('fa-eye-slash');
element.classList.add('fa-eye');
}
}
</script>
</body>
</html>