anhskohbo / no-captcha

No CAPTCHA reCAPTCHA For Laravel.
https://packagist.org/packages/anhskohbo/no-captcha
MIT License
1.78k stars 234 forks source link

validation.captcha #24

Closed felixlandicho closed 8 years ago

felixlandicho commented 9 years ago

Hi,

Why do I receive this error? even if the noCaptcha is a green check.

"g-recaptcha-response" => array:1 [ 0 => "validation.captcha" ]

Thanks

anhskohbo commented 9 years ago

I'll check and reply you soon

d3rd4v1d commented 9 years ago

I have same issue.

Lotuashvili commented 8 years ago

@anhskohbo I have the same issue, please answer :)

lehnen commented 8 years ago

Same for me. I run it under Homestead witch success. On my provider (Hosteurope) the same code fails with above message.

Lotuashvili commented 8 years ago

@lehnen I had incorrect secret key copied in my configuration file, please double check :)

Good luck

lehnen commented 8 years ago

@Lotuashvili Nice quick answer ;) I checked the keys and they are identical on both sides. Also both domains are mentioned in Googles reCapcha console as valid for the keys.

lehnen commented 8 years ago

Fix for me: I wanted to use ReCaptcha, not NoCaptcha. Since the documentation of reCaptcha states to use POST parameter for validation (https://developers.google.com/recaptcha/docs/verify#api-request) I implemented it by myself, based on this code. I used Guzzle to make a POST request instaed of the GET request used by the original code an it works.

nhtua commented 8 years ago

Maybe you are trying to validate one recaptcha's response twice (when resubmit form). Every result key is one-time used.

anhskohbo commented 8 years ago

Fixed with latest commit.

Tarasovych commented 6 years ago

@anhskohbo Still same issue. I get validation.captcha in both situations:

May this error being caused by non-https request to recaptcha api (I'm on local now)?

Can I set custom validation message for this case?

Tarasovych commented 6 years ago

Anybody here?

mpge commented 6 years ago

Can confirm, I receive this as well with the current version.

Tarasovych commented 6 years ago

Still have a problem too.

mpge commented 6 years ago

Checked my secret/private key, turns out Google for whatever reason reset the key on me.

Maybe check that.

bikify commented 5 years ago

still getting this issue with laravel 5.8.

i was using this from documentation

$validate = Validator::make(Input::all(), [
    'g-recaptcha-response' => 'required|captcha'
]);

then i changed it to this

$validate = Validator::make(Input::all(), [
    'g-recaptcha-response' => 'required'
]);

according to stackoverflow and it worked liked charm.

khairulhasanmd commented 4 years ago

@iwaqarhussain I can confirm, that works. Thanks.

mpge commented 4 years ago

@iwaqarhussain I can confirm, that works. Thanks.

I'm assuming this effectively just removes the validation for the captcha - hence, if the captcha is invalid/not correctly filled, it won't actually throw an error which is entirely the point of the captcha.

Not sure i'd reco this.

bikify commented 4 years ago

@iwaqarhussain I can confirm, that works. Thanks.

I'm assuming this effectively just removes the validation for the captcha - hence, if the captcha is invalid/not correctly filled, it won't actually throw an error which is entirely the point of the captcha.

Not sure i'd reco this.

No, that's not the way this works.

It do what it's supposed to do

mpge commented 4 years ago

@iwaqarhussain I can confirm, that works. Thanks.

I'm assuming this effectively just removes the validation for the captcha - hence, if the captcha is invalid/not correctly filled, it won't actually throw an error which is entirely the point of the captcha. Not sure i'd reco this.

No, that's not the way this works.

It do what it's supposed to do

You may get client side validation on behalf of google, but in terms of your own actual server side validation, if you have no other code to validate the captcha, it will not be validated on your end (server side) AFAIK.

If you don't use the "captcha" rule, the function verifyResponse will not be hit. verifyResponse is the function that effectively checks with Google to ensure that the token provided through the post requests matches and is valid.

There should be another solution other than simply removing the rule all-together. Otherwise your captcha may not be solid.

You can see that someone commented below on the solution on StackOverflow.

nasirkhannstu commented 3 years ago

Please dont use this: 'g-recaptcha-response' => 'required'

Use this format: 'g-recaptcha-response' => 'required|captcha'

Check your API Key AND settings in Console. It should work.