javarecaptcha

How can I change the error message when using Google ReCaptcha version 2?


When multiple photos are selected for the Google ReCaptcha version 2, it displays the following error message:

"Multiple correct solutions required - please solve more."

How can i change the error message to be a custom message from my site?

Here is the image:

enter image description here


Solution

  • I think it's not possible to do server-side (at google). This rather might be done client-side by leveraging js to substitute HTML of the newly received reCaptcha pictures code:

    HTML

    <div class="rc-imageselect-incorrect-response" style="">Multiple correct solutions required – please solve more.</div>
    

    so you find this line of code and replace:

    JS (Jquery)

    $('.rc-imageselect-incorrect-response').text('Custom message');
    

    When?

    This action you should perform each time after XHR https://www.google.com/recaptcha/api2/userverify?k=6LdYKQkTAAAAAD9K6-kHspFU... is complete. Yet since this ajax request is done by google's reCaptcha's api code, it's not that easy to catch up with it.