misc: tweak captchas

This commit is contained in:
Xyphyn committed 2023-08-18 17:05:23 -07:00
1 parent adc96c8e26
commit 28ffdc5ed8
1 file changed
+18 -8
+18 -8
View File
@@ -13,6 +13,8 @@
import { getClient } from '$lib/lemmy.js' import { getClient } from '$lib/lemmy.js'
import type { GetCaptchaResponse } from 'lemmy-js-client' import type { GetCaptchaResponse } from 'lemmy-js-client'
import { import {
ArrowPath,
ExclamationCircle,
ExclamationTriangle, ExclamationTriangle,
Icon, Icon,
QuestionMarkCircle, QuestionMarkCircle,
@@ -148,30 +150,38 @@
{#if captchaRequired} {#if captchaRequired}
<div> <div>
<div class="block my-1 font-bold text-sm">Captcha</div> <div class="block my-1 font-bold text-sm">Captcha</div>
<div class="flex flex-col gap-4">
{#await getCaptcha()} {#await getCaptcha()}
<Spinner width={32} /> <Spinner width={32} />
{:then} {:then}
{#if captcha?.ok} {#if captcha?.ok}
<div class="flex flex-col gap-4">
<img <img
src="data:image/png;base64,{captcha.ok.png}" src="data:image/png;base64,{captcha.ok.png}"
alt="Captcha" alt="Captcha"
class="w-max" class="w-max"
/> />
<audio controls src={captchaAudio} /> <audio controls src={captchaAudio} />
{:else}
<Card cardColor="warning" class="p-3 flex gap-2">
<Icon src={QuestionMarkCircle} mini size="24" />
No captcha was returned
</Card>
{/if}
{:catch err}
<Card cardColor="error" class="p-3 flex gap-2">
<Icon src={ExclamationCircle} mini size="24" />
{err}
</Card>
{/await}
<Button on:click={() => getCaptcha()} size="square-md">
<Icon src={ArrowPath} size="16" mini />
</Button>
<TextInput <TextInput
required required
bind:value={verifyCaptcha} bind:value={verifyCaptcha}
placeholder="i guess i'm a robot" placeholder="i guess i'm a robot"
/> />
</div> </div>
{:else}
<div class="flex gap-2">
<Icon src={QuestionMarkCircle} mini size="24" />
No captcha was returned :(
</div>
{/if}
{/await}
</div> </div>
{/if} {/if}
<input type="dn" name="honeypot" bind:value={honeypot} class="hidden" /> <input type="dn" name="honeypot" bind:value={honeypot} class="hidden" />