laravel-captcha icon indicating copy to clipboard operation
laravel-captcha copied to clipboard

Blade template @captcha not showing image

Open Thungdemo opened this issue 5 years ago • 8 comments

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

Thungdemo avatar Jan 14 '20 07:01 Thungdemo

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

kurianbenny avatar Jan 30 '20 15:01 kurianbenny

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.

Thungdemo avatar Jan 31 '20 07:01 Thungdemo

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

php artisan view:clear

silverark avatar Mar 23 '20 19:03 silverark

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

anasalpure avatar Oct 10 '20 06:10 anasalpure

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()}"
>

Thungdemo avatar Oct 14 '20 07:10 Thungdemo

Have this issue as well

oureco123 avatar Mar 26 '21 16:03 oureco123

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

vpmwbeeler avatar Jun 08 '21 17:06 vpmwbeeler

I am getting the same error

padi-dev-lucvt avatar Jan 17 '22 02:01 padi-dev-lucvt