Closed jonjie0317 closed 6 years ago
it also returns null, because we're just returning all inputs. any idea? need help, Thanks!
form
<form action="{{ route('auth.form') }}" method="post">
{!! Recaptcha::render() !!}
<input type="submit" value="Submit">
</form>
method
public function postForm(Request $request){
dd($request->input('g-recaptcha-response'));
// Some private code...
}
As simple as that, just for testing, but doesnt work.
@jonjie0317 Maybe you should first validate that that field isn't empty...
@jonjie0317 Add dd($request->all());
at the top of postForm
(you can also do dd(\Request::all())
). Also, are you type sniffing the Request
properly? Make sure that the $request
object you're looking at is of type Illuminate\Http\Request
.
Yes, I typed it properly Illuminate\Http\Request
. I tried dd($request->all());
, it returns:
array:11 [▼ "username" => "" "password" => "" "_token" => "75rpLAPo6gXdsP9FLUWA6ma3pvcT4db6agE1yxaRw" ]
..No g-recaptcha-response
returns.
Same issue.
If form sended from Firefox always
"g-recaptcha-response" => null
In Chrome everything working fine.
App log clear, no errors in Apache too.
Tried set config
'curl_verify' => false,
or
'driver' => 'native',
But response still null
@ivzinoviev Have you try to change the place of your {!! Recaptcha::render() !!}
in the form? You may try at the beginning of the form. e.g.
<form action="" method="post">
{!! Recaptcha::render() !!}
<!-- Other inputs here... -->
<input type="submit" value="Register">
</form>
@jonjie0317 Yes, it takes no effect. Only found solution is using https instead http.
UPD: in my case it works only if form accessed via https but act via http. Strange.
@ivzinoviev Oh, that's great! 👍 thank you for sharing your solution, so this will help others.
I am on HTTPS Still face the issue.
Any help?
I replaced the {!! Recaptcha::render() !!} with standard field code
and it works well
If a client-side call to grecaptcha.getResponse()
returns a correct response, then this workaround should help solve the problem: Getting Null in g-recaptcha-response Google's reCaptcha
It returns
null
when I useddd()
in it. My code:dd($request->input('g-recaptcha-response'));