mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
fix: reset Turnstile on login and registration error handling
This commit is contained in:
@@ -252,7 +252,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
{#if data.options?.requiresVerification && data.auth?.cf_turnstile_site_key}
|
{#if data.options?.requiresVerification && data.auth?.cf_turnstile_site_key}
|
||||||
<div
|
<div
|
||||||
class="mt-2 flex w-auto items-center justify-center rounded border border-neutral-700 bg-neutral-800 p-2 pb-1"
|
class="mt-2 min-h-16.25 flex w-auto items-center justify-center rounded border border-neutral-700 bg-neutral-800 p-2 pb-1"
|
||||||
>
|
>
|
||||||
<div class="cf-turnstile" data-sitekey={data.auth.cf_turnstile_site_key}></div>
|
<div class="cf-turnstile" data-sitekey={data.auth.cf_turnstile_site_key}></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -73,6 +73,9 @@
|
|||||||
const messages = Object.values(resData.errors).flat();
|
const messages = Object.values(resData.errors).flat();
|
||||||
error = messages.join('\n');
|
error = messages.join('\n');
|
||||||
} else {
|
} else {
|
||||||
|
if (window.turnstile) {
|
||||||
|
window.turnstile.reset();
|
||||||
|
}
|
||||||
if (resData.message === 'TOTP code is required.') {
|
if (resData.message === 'TOTP code is required.') {
|
||||||
totpEnabled = true;
|
totpEnabled = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,6 +96,9 @@
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const resData = await res.json();
|
const resData = await res.json();
|
||||||
|
if (window.turnstile) {
|
||||||
|
window.turnstile.reset();
|
||||||
|
}
|
||||||
if (resData.errors) {
|
if (resData.errors) {
|
||||||
const messages = Object.values(resData.errors).flat();
|
const messages = Object.values(resData.errors).flat();
|
||||||
error = messages.join('\n');
|
error = messages.join('\n');
|
||||||
|
|||||||
Reference in New Issue
Block a user