Hey!
I'm trying to add Google reCAPTCHA to the login and register pages. I'm using Fortify.
I've read the Fortify documentation and ended up with this code inside the FortifyServiceProvider:
Fortify::authenticateUsing(function (Request $request) {
return $request->validate(
[
'g-recaptcha-response' => 'required|recaptcha'
],
[
'g-recaptcha-response.required' => 'Please, pass the captcha.',
'g-recaptcha-response.recaptcha' => 'Captcha verification failed!'
]
);
});
but when I try to log in with correct credentials I get this error:
lluminate\Auth\SessionGuard::login(): Argument #1 ($user) must be of type Illuminate\Contracts\Auth\Authenticatable, array given ....
and when I remove the code from the FortifyServiceProvider the login works perfect. Any idea what is causing this issue? Also how can I define on which pages this code to be executed? Is Fortify::authenticateUsing() called only on the login and register pages?