Needs work
Project:
COOKiES Consent Management
Version:
1.0.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 Jul 2022 at 16:38 UTC
Updated:
25 Oct 2024 at 05:53 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
anybodyI had a deeper look and found the reason:
in cookies_recaptcha.module we can find this code:
But in the patch the #attached part is changed and

$captcha["form"]["recaptcha_widget"]["#attached"]is no more as expected:It now uses libraries (which is good), but our code has to be aligned accordingly. As written above it should be able to handle both cases for now. I guess we should add a further if and comments.
Comment #3
anybody@JFeltkamp, I'm unsure if that also means we have to knockout the recaptcha libraries... what do you think? Is there any similar example? All I found use html_head.
"recaptcha/google.recaptcha_XXX" is even external. And dynamically generated, see this part of the patch:
Comment #4
guido_sYes, libraries need to be blocked if they contain external resources or set cookies.
Maybe something like this?
cookies_recaptcha.module
Create an Ajax Controller
src/Controller/AjaxController.php
Create a route for this:
cookies_recaptcha.routing.yml
And do some ajax request in js/cookies_recaptcha.js if libraries are set in drupalSettings?
But I couldn't get this to work yet.
Can anyone help with this?
We need to get this working for GDPR / DSGVO.
Comment #5
myha commentedI played further with @Guido_S code and generated patch. I didn't play with legacy recaptcha code so the patch will work only with recaptcha patch .
Comment #7
anybody@myha thanks, could you prepare this as MR?
Comment #8
guido_sIt seems the patch doesn't apply anymore and needs an update for the current cookies module version 1.2.2.
Comment #9
frondeau commentedHi all,
Thank you Myha for the patch https://www.drupal.org/files/issues/2022-09-23/recaptcha_protection_broken_withajax_patch-3296032-5.patch. It's working well in my use case.
Comment #10
dilnaekio commentedHello,
I tried to apply this patch on 1.2.3 version and it's not working anymore :(
It needs a new update for the current version :)
Comment #11
berramou commentedThis patch works for me with:
Custom form (built with form API)
Webform
Webform in a modal with Ajax
Comment #12
phannphong commentedThis patch works with the version 1.2.13 when the ticket #2493183: Ajax support / Use behaviors is fixed.