anhskohbo / no-captcha

No CAPTCHA reCAPTCHA For Laravel.
https://packagist.org/packages/anhskohbo/no-captcha
MIT License
1.76k stars 236 forks source link

Livewire support #184

Open emtiazzahid opened 1 year ago

emtiazzahid commented 1 year ago

tried with that

   <div wire:ignore>
        {!! NoCaptcha::renderJs() !!}
        {!! NoCaptcha::display(['data-callback' => 'onCallback']) !!}
   </div>

but when livewire returns validation errors its not refresh with new captcha Laravel version: 9.19 Livewire: 2.10

hmreumann commented 1 year ago

You need to somehow dispatch grecaptcha.reset()

Maybe using AlpineJs x-intersect on the captcha validation error message

AliMosbah commented 1 year ago

Work with me 💯 public $recaptcha

$this->validate([ 'recaptcha' => 'required|captcha', ]);

------ In blade :

{!! NoCaptcha::display() !!} {!! NoCaptcha::renderJs(['data-callback' => 'onCallback' ]) !!}

@error('recaptcha') {{ $message }} @enderror

@push('scripts')

@endpush