Skip to content

Commit 54ab580

Browse files
committed
fix: reset captcha after consuming the token.
1 parent 87685f5 commit 54ab580

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

index.html

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@
7070
inject: `
7171
const supabase = $module.createClient(
7272
"https://qmpdruitzlownnnnjmpk.supabase.co",
73-
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InFtcGRydWl0emxvd25ubm5qbXBrIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDk2NjA0NTYsImV4cCI6MjA2NTIzNjQ1Nn0.OhD3qN4dq0TMA65qVGvry_QsZEeLKK7RbwYP3QzAvcY",
74-
{ auth: {
73+
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InFtcGRydWl0emxvd25ubm5qbXBrIiwicm9zZSI6ImFub24iLCJpYXQiOjE3NDk2NjA0NTYsImV4cCI6MjA2NTIzNjQ1Nn0.OhD3qN4dq0TMA65qVGvry_QsZEeLKK7RbwYP3QzAvcY",
74+
{
75+
auth: {
7576
detectSessionInUrl: false,
7677
persistSession: false,
7778
}
@@ -378,11 +379,18 @@
378379
></div>
379380
<button
380381
onclick="closeCaptcha()"
381-
style="margin-top: 16px"
382+
style="margin-top: 16px; margin-right: 8px;"
382383
class="px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded shadow transition-colors duration-150"
383384
>
384385
Cancel
385386
</button>
387+
<button
388+
onclick="resetCaptcha()"
389+
style="margin-top: 16px;"
390+
class="px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded shadow transition-colors duration-150"
391+
>
392+
Reset Captcha
393+
</button>
386394
</div>
387395
</div>
388396
<script>
@@ -409,6 +417,7 @@
409417
break;
410418
case "register":
411419
console.log("[DEBUG]: Called Registered Here");
420+
resetCaptcha();
412421
if (
413422
message &&
414423
message.email &&
@@ -454,7 +463,7 @@
454463
break;
455464
case "login":
456465
console.log("[DEBUG]: Called Login Here");
457-
466+
resetCaptcha();
458467
if (
459468
message &&
460469
message.email &&
@@ -532,6 +541,9 @@
532541
console.log("[JSRust]", message);
533542
}
534543
break;
544+
case "resetCaptcha":
545+
resetCaptcha();
546+
break;
535547
// Add more actions as needed
536548
default:
537549
console.warn("[JSRust] Unknown action:", action, message);
@@ -565,6 +577,17 @@
565577
);
566578
}
567579
};
580+
581+
function resetCaptcha() {
582+
if (window.hcaptcha) {
583+
window.hcaptcha.reset();
584+
} else {
585+
const widget = document.querySelector(".h-captcha");
586+
if (widget && widget.reset) {
587+
widget.reset();
588+
}
589+
}
590+
}
568591
</script>
569592
<!-- End hCaptcha integration -->
570593
</body>

0 commit comments

Comments
 (0)