ampproject / amphtml

The AMP web component framework.
https://amp.dev
Apache License 2.0
14.89k stars 3.89k forks source link

Support reCAPTCHA component #2273

Closed lisotton closed 5 years ago

lisotton commented 8 years ago

Hi everyone,

I don't know if someone is already working in this request, but I believe that we need to implement support for recaptcha in AMP.

Thanks.

nainar commented 5 years ago

The above user has been blocked from posting on this project.

While the initial comments have been deleted, we nonetheless apologize to the others in this thread.

nickmoline commented 5 years ago

@Frenchomatic

I'm sorry you are frustrated, but this is not the reCAPTCHA project, documentation about the reCAPTCHA project is completely separate from the documentation on AMP. What is documented on the AMP project is how to use the AMP Component, validation of reCAPTCHA is the same regardless if the post came from AMP or not, and unless someone from reCAPTCHA happens to be lurking on these issues, the people on the AMP team (and volunteers) are not equipped to answer questions outside of the scope of AMP.

The main documentation for reCAPTCHA V3 (the amp component uses V3) can be found here: https://developers.google.com/recaptcha/docs/v3

And documentation about validating responses from recaptcha servers can be found here: https://developers.google.com/recaptcha/docs/verify

The reCAPTCHA project has their own forum on stackoverflowwith their own set of community volunteers who try to help people available here: https://stackoverflow.com/questions/tagged/recaptcha?sort=frequent

The code snippet you pasted in your previous post is well on its way towards validating the response, there's comments where your code would be, it takes the token included in the form post fields, sends it on to the reCAPTCHA validation service, and then has an if statement to determine what to do with the post depending on that score. In the sample code there is an if ($recaptcha->score >= 0.5) { and inside that is where you'd do your normal processing of the form, and in the else statement is what you'd do if they didn't validate the captcha submission.