InvalidRecaptchaException
Closed this issue · 6 comments
Hello,
Love your application, it's a life saver and very easy to use. Recently, I have implemented this in an application and we're getting a lot of InvalidRecaptchaException in our log.
Is this an implementation issue or something that I can address? How would you suggest I catch and recover from this error gracefully, because right now it's just resulting in a 500 error dead end for users.
Here's some cleaned up code, but I'm using the middleware implementation on our login controller.
Login view:
<div class="card-body">
<form method="POST" action="{{ route('login') }}" data-recaptcha="true">
@csrf
.... form fields here
</form>
</div>
LoginController.php
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest')->except('logout');
$this->middleware('recaptcha')->only('login');
}
I am not overriding the default login() logic to include an isRobot check or anything of that nature.
Suggestions?
I have the same issue...
- That exception appears when the input doesn't have the default "_recaptcha" key, or is not a string.
Gonna check this weekend what could cause the problem. Probably the script isn't injecting the token on submission, which may be a Javascript problem.
Nevermind, I just pushed a patch to the master branch. If you could test the new code manually in it and report back it would be awesome.
composer require darkghosthunter/captchavel:dev-master --prefer-source
Confirmed this fix works! It re-queries the Captcha server when you hit submit and works.
THANK YOU
Okay, the fix is going live in some minutes.
Fixed in v2.1.2. Happy coding.