-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreset-password.html
More file actions
423 lines (380 loc) · 14.5 KB
/
Copy pathreset-password.html
File metadata and controls
423 lines (380 loc) · 14.5 KB
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
<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
<meta charset="UTF-8" />
<meta name="description" content="Reset your password." />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<!-- The above 4 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<!-- Title -->
<title>Reset Password - Hereditas</title>
<!-- Favicon -->
<link rel="icon" href="assets/img/favicon.png" />
<!-- ***** All CSS Files ***** -->
<!-- Style css -->
<link rel="stylesheet" href="assets/css/style.css" />
</head>
<body>
<div class="main">
<!-- ***** Preloader Start ***** -->
<div class="preloader-main">
<div class="preloader-wapper">
<svg
class="preloader"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="600"
height="200"
>
<defs>
<filter id="goo" x="-40%" y="-40%" height="200%" width="400%">
<feGaussianBlur
in="SourceGraphic"
stdDeviation="10"
result="blur"
/>
<feColorMatrix
in="blur"
mode="matrix"
values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 19 -8"
result="goo"
/>
</filter>
</defs>
<g filter="url(#goo)">
<circle class="dot" cx="50" cy="50" r="25" fill="#203d52" />
<circle class="dot" cx="50" cy="50" r="25" fill="#203d52" />
</g>
</svg>
<div>
<div class="loader-section section-left"></div>
<div class="loader-section section-right"></div>
</div>
</div>
</div>
<!-- ***** Preloader End ***** -->
<!-- ***** Header Start ***** -->
<header id="header">
<!-- Navbar -->
<nav
data-aos="zoom-out"
data-aos-delay="800"
class="navbar gameon-navbar navbar-expand"
>
<div class="container header">
<!-- Logo -->
<a class="navbar-brand" href="index.html#home">
<img
src="assets/img/logo/logo.png"
alt="Brand Logo"
style="height: 35px"
/>
</a>
<div class="ms-auto"></div>
<!-- Navbar Nav -->
<ul class="navbar-nav items mx-auto">
<li class="nav-item">
<a class="nav-link" href="index.html#home">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="index.html#features">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="index.html#screenshots"
>Screenshots</a
>
</li>
<li class="nav-item">
<a class="nav-link" href="index.html#pricing">Pricing</a>
</li>
<li class="nav-item">
<a class="nav-link" href="index.html#contact">Contact</a>
</li>
</ul>
<!-- Navbar Icons -->
<ul class="navbar-nav icons"></ul>
<!-- Navbar Toggler -->
<ul class="navbar-nav toggle">
<li class="nav-item">
<a
href="#"
class="nav-link"
data-bs-toggle="modal"
data-bs-target="#menu"
>
<i class="icon-menu m-0"></i>
</a>
</li>
</ul>
</div>
</nav>
</header>
<!-- ***** Header End ***** -->
<!-- ***** Password Reset Area Start ***** -->
<section
id="home"
class="download subscribe-area has-overlay overlay-gradient vh-100"
>
<div class="container h-100">
<div class="row justify-content-center align-items-center h-100">
<div class="col-12 col-md-6 col-lg-5">
<!-- Password Reset Form -->
<div id="reset-form" style="display: none">
<h1 class="text-white text-center mb-4">Reset Your Password</h1>
<p class="text-white text-center mb-4">
Please enter your new password below.
</p>
<form id="password-reset-form">
<div class="mb-3">
<input
type="password"
class="form-control"
id="new-password"
placeholder="New Password"
required
/>
</div>
<div class="mb-4">
<input
type="password"
class="form-control"
id="confirm-password"
placeholder="Confirm New Password"
required
/>
</div>
<div
id="form-error"
class="alert alert-danger"
style="display: none"
></div>
<button
type="submit"
class="btn btn-primary w-100 mb-3"
id="submit-btn"
>
Reset Password
</button>
</form>
</div>
<!-- Success Message -->
<div id="success-message" style="display: none">
<h1 class="text-white text-center">
Password Reset Successful!
</h1>
<p class="text-white text-center">
Your password has been successfully reset. You can now go back
to the app to log in with your new password.
</p>
<div class="text-center mt-4">
<a href="index.html#home" class="btn btn-primary"
>Go to Home</a
>
</div>
</div>
<!-- Error Message -->
<div id="error-message" style="display: none">
<h1 class="text-white text-center">Password Reset Failed</h1>
<p class="text-white text-center" id="error-description">
There was an error with your password reset link.
</p>
<p class="text-white text-center mt-3">
Please request a new password reset link or contact support if
the problem persists.
</p>
<div class="text-center mt-4">
<a href="index.html#home" class="btn btn-primary"
>Go to Home</a
>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- ***** Password Reset Area End ***** -->
<!--====== Modal Responsive Menu Area Start ======-->
<div id="menu" class="modal fade p-0">
<div class="modal-dialog modal-dialog-slideout">
<div class="modal-content full">
<div class="modal-header" data-bs-dismiss="modal">
Menu <i class="icon-close"></i>
</div>
<div class="menu modal-body">
<div class="row w-100">
<div class="items p-0 col-12 text-center">
<!-- Append [navbar] -->
</div>
</div>
</div>
</div>
</div>
</div>
<!--====== Modal Responsive Menu Area End ======-->
</div>
<!-- ***** All jQuery Plugins ***** -->
<!-- jQuery(necessary for all JavaScript plugins) -->
<script src="assets/js/vendor/jquery.min.js"></script>
<!-- Bootstrap js -->
<script src="assets/js/vendor/popper.min.js"></script>
<script src="assets/js/vendor/bootstrap.min.js"></script>
<!-- Plugins js -->
<script src="assets/js/vendor/slider.min.js"></script>
<script src="assets/js/vendor/owl.carousel.min.js"></script>
<script src="assets/js/vendor/counterup.js"></script>
<script src="assets/js/vendor/waypoint.js"></script>
<script src="assets/js/vendor/aos.js"></script>
<script src="assets/js/vendor/wow.min.js"></script>
<script src="assets/js/vendor/gallery.min.js"></script>
<!-- Main js -->
<script src="assets/js/main.js"></script>
<!-- Supabase JS -->
<script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js@2"></script>
<!-- Config JS -->
<script src="assets/js/config.js"></script>
<!-- Reset Password Page Logic -->
<script>
(function () {
const params = new URLSearchParams(window.location.hash.substring(1));
const accessToken = params.get("access_token");
const error = params.get("error");
const errorDescription = params.get("error_description");
const resetForm = document.getElementById("reset-form");
const successMsg = document.getElementById("success-message");
const errorMsg = document.getElementById("error-message");
const errorDesc = document.getElementById("error-description");
const passwordForm = document.getElementById("password-reset-form");
const formError = document.getElementById("form-error");
const submitBtn = document.getElementById("submit-btn");
function showError(message) {
resetForm.style.display = "none";
successMsg.style.display = "none";
errorMsg.style.display = "block";
errorDesc.textContent = message;
}
// Handle error case
if (error) {
showError(
errorDescription
? decodeURIComponent(errorDescription)
: "There was an error with your password reset link."
);
return;
}
// Extract Supabase URL from token
let supabaseUrl = "";
if (accessToken) {
try {
const payload = JSON.parse(atob(accessToken.split(".")[1]));
if (payload.iss) {
supabaseUrl = payload.iss.replace("/auth/v1", "");
}
} catch (e) {
console.error("Failed to extract Supabase URL:", e);
}
}
// Get Supabase anon key (must be set via window.SUPABASE_ANON_KEY)
const supabaseAnonKey = window.SUPABASE_ANON_KEY;
// Validate configuration - only check that we have required values
if (!supabaseUrl || !supabaseAnonKey) {
showError(
!supabaseUrl
? "Invalid reset token. Please request a new password reset link."
: "Configuration error. Please contact support."
);
return;
}
// Initialize Supabase and show form
const supabase = window.supabase.createClient(
supabaseUrl,
supabaseAnonKey
);
if (accessToken) {
resetForm.style.display = "block";
successMsg.style.display = "none";
errorMsg.style.display = "none";
// Set session with access token and handle form submission
(async () => {
try {
const { error: sessionError } = await supabase.auth.setSession({
access_token: accessToken,
refresh_token: params.get("refresh_token") || "",
});
if (sessionError) {
showError("Failed to establish session. Please try again.");
return;
}
// Handle form submission - only after session is set
passwordForm.addEventListener("submit", async (e) => {
e.preventDefault();
const newPassword =
document.getElementById("new-password").value;
const confirmPassword =
document.getElementById("confirm-password").value;
// Validate password requirements
if (newPassword.length < 8) {
formError.textContent =
"Password must be at least 8 characters long";
formError.style.display = "block";
return;
}
if (!/[A-Z]/.test(newPassword)) {
formError.textContent =
"Password must contain at least one uppercase letter";
formError.style.display = "block";
return;
}
if (!/[a-z]/.test(newPassword)) {
formError.textContent =
"Password must contain at least one lowercase letter";
formError.style.display = "block";
return;
}
if (!/\d/.test(newPassword)) {
formError.textContent =
"Password must contain at least one digit";
formError.style.display = "block";
return;
}
// Validate passwords match
if (newPassword !== confirmPassword) {
formError.textContent = "Passwords do not match";
formError.style.display = "block";
return;
}
formError.style.display = "none";
submitBtn.disabled = true;
submitBtn.textContent = "Resetting Password...";
try {
const { error: updateError } = await supabase.auth.updateUser(
{
password: newPassword,
}
);
if (updateError) throw updateError;
resetForm.style.display = "none";
successMsg.style.display = "block";
errorMsg.style.display = "none";
} catch (error) {
formError.textContent =
error.message ||
"Failed to reset password. Please try again.";
formError.style.display = "block";
submitBtn.disabled = false;
submitBtn.textContent = "Reset Password";
}
});
} catch (error) {
showError("Failed to establish session. Please try again.");
}
})();
} else {
showError("Invalid or missing reset token.");
}
})();
</script>
</body>
</html>