igoshev / laravel-captcha

Captcha integration for the Laravel
https://laravel.bonecms.tech/laravel-captcha
MIT License
79 stars 37 forks source link

Blade template @captcha not showing image #40

Open Thungdemo opened 4 years ago

Thungdemo commented 4 years ago

Blade template directive @captcha not showing image after updating from v2.1 to v2.2.

kurianbenny commented 4 years ago

@ThungdemoEzong got any solution? In my case the image is properly loading in localhost but not in my digital ocean server. @igoshev

Thungdemo commented 4 years ago

https://github.com/igoshev/laravel-captcha/blob/49f798a3dec12305306ccd0c90f1d2f5ce4997ca/src/Captcha/Captcha.php#L107

changing $route = route('bone.captcha.image', [], false) to
$route = route('bone.captcha.image', []) fixes the issue The passing false as the third parameter generates a relative URL which causes the issue.

silverark commented 4 years ago

I had to clear the laravel view cache storage/framework/views

php artisan view:clear
anasalpure commented 3 years ago

I try all this solations but it still not showing image image

Thungdemo commented 3 years ago

For those using v2.2.*, I have found a workaround.

Publish the view files

php artisan vendor:publish --provider="Igoshev\Captcha\Providers\CaptchaServiceProvider" --tag="bone-captcha-views"

Open the file resources/views/vendor/bone/captcha/image.blade.php

Then replace everything with the following code

<img src="{{ route('bone.captcha.image') . '?' . mt_rand() }}"
     alt="my-captcha"
     style="cursor:pointer;width:auto;height:38px;"
     title="{{ $title }}"
     onclick="this.setAttribute('src','{{ route('bone.captcha.image') . '?' . mt_rand() }}&_='+Math.random());var captcha=document.getElementById('{{ $input_id }}');if(captcha){captcha.focus()}"
>
oureco123 commented 3 years ago

Have this issue as well

vpmwbeeler commented 3 years ago

This is still not fixed. It works fine in my dev environment, but not on the AWS instance.

padi-dev-lucvt commented 2 years ago

I am getting the same error