captcha
captcha copied to clipboard
Cannot return error message if verification fails
version laravel 7.12.0
I added a verification code to login But after the verification fails, the URL redirected to the verification code picture.
The reason it happened is that the url of the picture is not a static file So if your page link to the url, It will be written to the session._previous When Laravel handle ValidationException will redirect session._previous url
In case it helps anyone else I faced the same issue with Laravel 8 but managed to get around it by replacing the {!! captcha_img() !!}
in my blade template with <img src="data:image/png;base64,{!! base64_encode(captcha()->getContent()) !!}">
This outputs the image content directly without requesting it from the /captcha endpoint and therefore doesn't replace the previous session URL..