Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
I just started to look over the v3 version of recaptcha and noticed there is only this module for D7.
There is an issue for the D8 recaptcha here to add support for v3, but no work has been done yet.
Should we port this module or implement in the D8 version of recaptcha ?
Comment | File | Size | Author |
---|---|---|---|
#18 | recaptcha_v3-fix-3029161-18.patch | 26.92 KB | dench0 |
#16 | recaptcha-v3-fix--3029161.patch | 17.92 KB | majid.ali |
#11 | recaptcha_v3.zip | 13.6 KB | dench0 |
Comments
Comment #2
dench0 CreditAttribution: dench0 commentedI'm don't know. If someone does not do it before, then I'm planing to do 8 version at the next month.
Comment #3
FiNeX CreditAttribution: FiNeX as a volunteer commentedIt should be very useful because reCaptha v2 is almost unusable, a lot of spambot are able to solve it :-(
Comment #4
majid.ali CreditAttribution: majid.ali at 1xINTERNET commentedI have ported this module to D8, can you please make me co maintainer of this module so i can push the code.
Comment #5
breidert CreditAttribution: breidert at 1xINTERNET commented+1
It would be great to see the ported version of the module in this namespace.
Comment #6
B-Prod CreditAttribution: B-Prod commentedMaintainers, could it be possible to create a D8 branch, so we could provide patches against it?
A simple empty README file would be enough :-)
@majid.ali already made a port for D8, it would be great that he could provide a patch on such D8 branch, so we can go on.
It would be great to use this existing project, instead of creating a new project apart...
@majid.ali Could you please create an issue for becoming a project maintainer, as stated in the Drupal documentation:
https://www.drupal.org/node/251466#procedure---own-project
Comment #7
majid.ali CreditAttribution: majid.ali at 1xINTERNET commentedThanks @b-prod i have created an issue to to be co maintainer as stated in the Drupal documentation. https://www.drupal.org/project/recaptcha_v3/issues/3094424
I would be happy to use this existing namespace rather creating a new one.
Comment #8
B-Prod CreditAttribution: B-Prod commented@majid.ali great, I also created such a request: https://www.drupal.org/project/recaptcha_v3/issues/3094620
Comment #9
B-Prod CreditAttribution: B-Prod commentedAnd a request to the d.org project ownership queue, hoping they could create the D8 branch do unblock us : https://www.drupal.org/project/projectownership/issues/3094622
Comment #10
B-Prod CreditAttribution: B-Prod commented@majid.ali I created the new D8 branch: https://www.drupal.org/project/recaptcha_v3/releases/8.x-1.x-dev
So you can now provide a patch with your code for review here.
You are also now a co-maintainer of this module, so we can go further now.
Comment #11
dench0 CreditAttribution: dench0 commented@majid.ali, B-Prod I attached archive with my code for poring this module to d8. I'm not remembering at which phase I stopped, because this code was written like 5-6 month ago. Maybe you would find something useful.
Comment #12
B-Prod CreditAttribution: B-Prod commented@dench0 Thank you for the source code!
@majid.ali Should I use the @dench0 code or wait for yours?
Comment #14
B-Prod CreditAttribution: B-Prod commentedComment #15
B-Prod CreditAttribution: B-Prod commented@dench0 your code has been integrated and adapted, we will perform tests and reviews next week, thanks again for your contribution!
Comment #16
majid.ali CreditAttribution: majid.ali at 1xINTERNET commented@drench0 @b-prod I have merged code from my module and created a patch. Its working with latest captcha /8.x-1.0-beta4 and reCaptcha 8.x-2.4 please review it.
Comment #18
dench0 CreditAttribution: dench0 commentedHere the new patch.
Short list of changes from the last commit:
1. Removed directory "src/Entity/Controller". @majid.ali why you are moved list builder there?
2. Modified and moved Entity interface to the
Drupal\recaptcha_v3
namespace3. Removed methods not related to the entity from
ReCaptchaV3Action
entity (token verification and creating empty action).4. Updated
ReCaptchaV3Action
entity definition (replace route_provider class and remove local_task_provider - previously used classes from contrib moduleentity
).5. Added function for recaptcha token verification to the
recaptcha_v3.module
file.@majid.ali question about this line:
in
recaptcha_v3_pre_captcha_element_process
function.I'm not understood for which purposes this line added?
Comment #19
majid.ali CreditAttribution: majid.ali at 1xINTERNET commented@dench0 According to the documentation https://www.drupal.org/docs/8/api/entity-api/creating-a-content-entity-t... list builder is in "src/Entity/Controller"
$form_state->setRebuild(TRUE); can be removed.
Comment #20
dench0 CreditAttribution: dench0 commented@majid.ali
1. In our module we have config entity, not content entity.
2. I'm thinking in that API documentation page confused different things. Exist two classes related to the entity list building:
EntityListController
andEntityListBuilder
. I'm thinking from the names of these two classes you can understand purposes of the each one. Then you can check core moduleblock
, which using exactly that 2 classes: first one in the namespaceDrupal\block\Controller
(not inDrupal\block\Entity\Controller
) and second -Drupal\block
3. I never saw before using of that strange namespace: neither in core nor in contributed modules (except captcha).
Comment #22
majid.ali CreditAttribution: majid.ali at 1xINTERNET commented@dench0 I was doing testing and found two issues, first one is more critical.
On line 208 of module file we are setting response in $form_state
$form_state->set('recaptcha_v3', $verification_response);
$form_state dose not retain this value after validation function. Therefore on a fallback challenge when you submit the form again it again sets recaptcha_v3 validation
And fallback challenge fails. I am struggling to find a solution. I am not sure if its right to put the response in session with captcha sid and not to use $form_state for that?
Second issue is if you enable recaptcha module and use it as fallback challenge then we get into trouble of different "google/recaptcha" library version. We are using the latest one and recpatcha has an old one which has a different structure. Should we use the same version of create a patch for recaptcha ?
Comment #24
dench0 CreditAttribution: dench0 commentedI pushed code with some changes, sorry that I done this without any discussion - I'm thinking in this stage it not big deal, because module does not have even alpha release.
You can check current solution to force form state caching starting from this line https://git.drupalcode.org/project/recaptcha_v3/commit/1996cfe#d011fd961... (line 209). There in comment you can see my concern about it.
Right now I don't know if this solution is bullet proof and will it correct for all cases. Maybe better in this function recaptcha_v3_pre_captcha_element_process on input processing add extra form element with captcha response.
Comment #25
dench0 CreditAttribution: dench0 commentedSo now need to check current form state caching solution.
Also need to write some js code for repeating token request after some time interval (it seems like after 2 minutes captcha response became outdated and token validation failed).
Comment #26
majid.ali CreditAttribution: majid.ali at 1xINTERNET commentedComment #27
majid.ali CreditAttribution: majid.ali at 1xINTERNET commented