Integrate Invisible reCAPTCHA option from Google

Created on 13 February 2017, almost 8 years ago
Updated 25 June 2023, over 1 year ago

Google is coming out with a new option for the reCAPTCHA service: https://developers.google.com/recaptcha/docs/invisible

It would be cool if we could have the option to use the invisible widget with this module. It doesn't look like there's much of a difference in markup for the invisible widget.

TODO:

  • The Invisible reCAPTCHA requires JavaScript and has no support for browsers without JavaScript enabled. This means the NOSCRIPT fallback no longer works and need to be removed if invisible captcha is used.
✨ Feature request
Status

Needs work

Version

3.0

Component

Invisible reCAPTCHA

Created by

πŸ‡ΊπŸ‡ΈUnited States amklose Wisconsin

Live updates comments and jobs are added and updated live.
  • Needs documentation

    A documentation change is requested elsewhere. For Drupal core (and possibly other projects), once the change has been committed, this status should be recorded in a change record node.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • First commit to issue fork.
  • Status changed to Needs review over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States smokris Athens, Ohio, USA

    I opened an issue fork consisting of hswong3i's patch from comment #206, plus a commit to remove another stray reference to the removed $noscript variable.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    2 fail
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    Patch Failed to Apply
  • πŸ‡«πŸ‡·France NuWans

    I'm on drupal 10 and recaptcha 3.2, the patch is not applicable on this version. Does anyone use it on this version? Is it planned to adapt?
    THANKS

  • πŸ‡ΊπŸ‡ΈUnited States dchaffin

    What is the status of this? I would really like to be able to update to reCaptcha v3. Thanks!

  • πŸ‡³πŸ‡ΏNew Zealand roxflame

    @dchaffin, I suggest using this other module while we wait for this to be integrated here
    https://www.drupal.org/project/recaptcha_v3 β†’

    You can use it as the primary captcha, and have it fall back to this module if it fails validation.

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    @smokris this please needs a rebase.
    All others: Once rebased, please test the MR and check if it's working. Can someone help about the documentation, please? (Needs documentation tag)

    I hope we can then integrate this soon.

    For the next time, I think it might make sense to add such new features as (experimental) separate submodules so we don't have to fear breaking something in production for the existing functionality?

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.1.x + Environment: PHP 8.2 & MySQL 8
    last update 11 months ago
    4 pass
  • πŸ‡ΊπŸ‡ΈUnited States smokris Athens, Ohio, USA

    Rebased.

  • Pipeline finished with Success
    11 months ago
    #64523
  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    @smokris thanks! There's still a TODO in the IS, is that old or still to TBD? Sorry I don't have much time currently, so further community help would speed up the process here for sure.

  • Status changed to Needs work 11 months ago
  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica
  • First commit to issue fork.
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.1.x + Environment: PHP 8.2 & MySQL 8
    last update 11 months ago
    4 pass
  • Pipeline finished with Success
    11 months ago
    Total: 144s
    #71561
  • πŸ‡«πŸ‡·France dark05

    Hello :-) It works with ReCaptcha version 3.2.0 and patch β†’
    Thanks

  • πŸ‡¨πŸ‡¦Canada OwilliwO Montreal

    Sadly, PR 15 diff is not applicable on top of 3.2 stable version.
    And the applicable patch from comment #206 is using an undefined variable $noscript (creating a PHP warning).

    Here is a quite patch I've applied on top of V3.2 + patch #206.

    diff --git a/recaptcha.module b/recaptcha.module
    index b28364a..435ac8b 100644
    --- a/recaptcha.module
    +++ b/recaptcha.module
    @@ -98,7 +98,6 @@ function recaptcha_captcha($op, $captcha_type = '') {
     
               $captcha['form']['recaptcha_widget'] = [
                 '#markup' => '<div' . new Attribute($attributes) . '></div>',
    -            '#suffix' => $noscript,
                 '#attached' => [
                   'html_head' => [
                     [
    

    Not sure why, but I've not been able to generate a full patch including this variable removal. Sorry about that.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.2.x + Environment: PHP 8.2 & MySQL 8
    last update 6 months ago
    4 pass
  • Pipeline finished with Failed
    6 months ago
    Total: 144s
    #192711
  • πŸ‡­πŸ‡°Hong Kong hswong3i
  • πŸ‡¬πŸ‡§United Kingdom amityweb

    Why is this so hard and so long to do? Why is it a patch? Come on guys this isn't rocket science

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    @amityweb please don't complain, but take the time or invest money to finish this. This is open source, it's not someones job ;)
    I understand the frustration and I'm running into the same sometimes, but it's not fair.

    What have YOU done to resolve this? (Looking above the answer seems to be: "Nothing", but hopefully "yet" ;))

    And yes, I agree this already took a lot too long, but comments like that don't help getting things done, please remember this. Participation helps!

  • πŸ‡¬πŸ‡§United Kingdom james.williams

    @amityweb maybe you - or anyone else! - could help with one of the following?

    1. Have you tested whether the latest work in the MR !15 is working for you? Could you report back with your findings?
    2. The phpunit job in the pipeline in MR !15 is failing, but it's doing so with code that seems to be passing fine in the latest 8.x-3.x code. I couldn't see why that would be.
    3. There is a 'TODO' note in the issue summary, suggesting "the NOSCRIPT fallback no longer works and need to be removed if invisible captcha is used" - can you check whether this is still the case? Either this needs to be done, or that note can be removed. I've added the 'Needs issue summary update' tag in the meantime.
    4. This issue has the 'needs documentation' tag, which was added in comment #145 ✨ Integrate Invisible reCAPTCHA option from Google Needs work by the former maintainer @hass . They wanted clarification on all sorts of details within the code changes, presumably as code comments. Do the current maintainers feel this is still necessary? I imagine that adding clarification with accurate code comments could do little harm anyway though.
  • πŸ‡¬πŸ‡§United Kingdom amityweb

    I am sorry @Anybody it is a complaint. I am new to Drupal and its extremely frustrating that features you expect to be standard in 2024 are just not there, or so hard to implement, or just do not work. I tried another extension just now, Simple ReCaptcha, it has V3 support. It does't work for me! I am not familiar enough with Drupal hooks and modules to do it myself, but I have created my own bespoke PHP form with Google ReCaptcha in a few hours. Less that I take to try and debug simple recaptcha. But thats not drupal, so not sure what I need to do for Drupal. Its just very frustrating especially after seeing this was raised 7 years ago.

    Due to no other solution I can find, I will use v2 captcha on this for now. I do think v2 checkbox is more reliable in my experience anyway, just does not look as good.

    One good thing from this though... I am very happy someone has replied to me! I have posted issues on many other extensions and no one ever replies. I often wonder if this website is even used! So now I know it is, and thank you for replying!

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    There are several conflicts in the MR now that need to be resolved carefully and tests are broken. So lots of things to do here for the community, if you'd like to push things forward! :)

    Happy to review and merge this, once it's ready!

  • Pipeline finished with Failed
    4 months ago
    #248047
  • Pipeline finished with Success
    4 months ago
    Total: 145s
    #248060
  • Pipeline finished with Failed
    4 months ago
    Total: 178s
    #248062
  • Pipeline finished with Success
    4 months ago
    Total: 295s
    #248444
  • πŸ‡ΊπŸ‡ΈUnited States xeiro

    #206 patch with 8.3.x was working until updating from D10.2.6 to D10.3.2 (broke with message "The answer you entered for the CAPTCHA was not correct"). Patch from merge request 15 fixed the issue and works using 8.3.4 on D10.3.2 - php8.2. Thank you!

  • πŸ‡¨πŸ‡ΎCyprus alex.bukach

    I tried MR !15, and a webform submission (an AJAX request) is sent earlier than reCaptcha token is received and populated. It looks like AJAX form submissions are not prevented for AJAX forms.

Production build 0.71.5 2024