using reCAPTCHA with ajax…javascript loading problem

前端 未结 7 2089
说谎
说谎 2021-02-14 04:08

I trying to implement reCAPTCHA in one of my forms,...but i am using ajax as the submission. (More specifically the prototype ajax.updater)

Once I submit and error check

7条回答
  •  悲哀的现实
    2021-02-14 04:30

    Be careful using any sort of client-side script, such as JavaScript, for validation. You have no control over the end-user's browser. The purpose of a CAPTCHA is to prevent automated submissions of a form. Anyone sophisticated enough to set that up isn't going to have a problem overriding your JavaScript validation and CAPTCHA checking. For example, they could set validateCaptcha() to always return true, bypassing your careful checks - or just disable JavaScript.

    That being said, there's nothing wrong with performing the entire form submission with ajax and using the results of the CAPTCHA check to determine if the form gets processed or not.

    The important point is that the decision of whether or not to handle the form has to be made on the server-side, not the client-side.

    Why client-side validation is not enough

提交回复
热议问题