zendframework / ZendService_ReCaptcha

BSD 3-Clause "New" or "Revised" License
7 stars 16 forks source link

New ReCaptcha #6

Closed Lansoweb closed 7 years ago

Lansoweb commented 9 years ago

Google launched a new ReCaptcha api version 2, but the actual is still working (don't know for how long). I have all set for a PR (already using on the development of a new project) but I need some insights.

There are some changes that would generate some backward incompatibilities. So either we create a ReCaptcha2.php and the developer can specify which one or a 3.0 version. and the dev specify in the composer configuration (2 or 3)

Since ZF2 uses this for it's ReCaptcha form helper (form/view), it needs to be changed too (i have it's PR ready too).

If we create a ReCaptcha2.php here, we need it on ZF2 too and when creating the captcha you can specify \Zend\Captcha\ReCaptcha or \Zend\Captcha\ReCaptcha2 (BC ok).

If we use a version 3.0 here, to try to maintain BC, the ZF2 form and view helpers should try to detect the version installed and use it.

Not sure the best approach here ... Any thoughs?

Regards, Leandro

crhallberg commented 9 years ago

I have a No CAPTCHA solution that I built based on this, and I'd love to contribute it, but is this the latest and future version of reCAPTCHA for Zend 2? It hasn't been updated in two years and there's a Captcha component in core now.

Do you know if this is active? Could you clear this up for me? Thank you.

crhallberg commented 9 years ago

I just forked my code here: https://github.com/crhallberg/ZendService_ReCaptcha

Lansoweb commented 9 years ago

I will fill a PR in a few days. But both are related. ZF2 Captcha is just a wrapper to this ZendService.

demiankatz commented 9 years ago

@Lansoweb, it's been a couple of months and it seems this hasn't progressed further. Have you been able to make any progress? Is there anything Chris or I could do to help? Thanks!

Lansoweb commented 9 years ago

@demiankatz I sill have no answer from dev team (is anyone looking this repository?). So i created a new module for this and i'm using in my projects. I already have some public modules for ZF2 and if someone needs, i would create a new one with the new Captcha.

demiankatz commented 9 years ago

@Lansoweb If it's not too much work for you to publish your new ReCaptcha work somewhere, that would be great -- if nothing else we can help you test it out. I suppose it might also be worth asking on the ZF2 IRC channel and/or mailing list who is maintaining this project, if anyone. If you haven't already tried this, let me know and I can send out a message. It doesn't always work, but sometimes you get a reply!

Lansoweb commented 9 years ago

@demiankatz Sure, no problem. Will clean up the code and create a public module for this. As soon i publish it, will inform you. Thanks.

Lansoweb commented 9 years ago

@demiankatz Just uploaded my code to github as a new module:

https://github.com/Lansoweb/LosReCaptcha

You can install with composer (los/losrecaptcha), just remove the zendframework/zendservice-recaptcha.

I've updated my projects to use it and it's working, could you try? It provides all necessary files, no need to install ZendService_ReCaptcha.

I use ZfcUser, so i reconfigured it's zfcuser.global.php:

'form_captcha_options' => array(
        'class'   => 'LosReCaptcha\Captcha\ReCaptcha',
        'label' =>'Type the code bellow:',
        'attributes' => array(
            'id' => 'captcha-input',
        ),
        'options' => array(
            'public_key' => 'xxx',
            'private_key' => 'yyy',
        ),
    ),

Will create a descriptive README soon.

crhallberg commented 9 years ago

@Lansoweb We are all set to go ahead with your implementation, we were wondering if you could please update the composer repo so we can ship with the latest code.

malganis93 commented 9 years ago

Just FYI i've created a module for the same purpose: https://github.com/malganis93/BrlReCaptcha Feel free to use it if you want.

Lansoweb commented 9 years ago

@crhallberg Hi! Sorry for the delay. Just created a 1.0.0 release. Need anything else? Regards, Leandro

demiankatz commented 9 years ago

@malganis93, thanks for sharing the link to your module. Have you looked at Lansoweb's version? At a glance, it looks like that one is a slightly better fit for our needs (for example, it has support for the non-Javascript version of the API, but I don't think I see that in your version). If yours is better for your own purposes, perhaps the two of you could talk about what would be needed for convergence. If the ultimate goal is to get some of this code accepted back into the ZF core, it would be ideal if we could all standardize on the same module. Of course, I understand that this isn't always practical!

@Lansoweb, thanks for the release! I think we're all set for now.

weierophinney commented 9 years ago

I somehow completely missed this (too many repos to track!).

Yes, we need to update to v2.

To answer @crhallberg , zend-captcha is a generic captcha library, and its ReCaptcha support actually delegates to this library — which means this library needs to be updated.

Does anybody want to open a PR to add the support? I'm not certain of the details and differences between the original version and the new one.

weierophinney commented 9 years ago

Also to clarify: we'll do a v3 on this repo. Major versions are used (in part) to signify backwards compatibility breaks. All that needs to happen is that we have documentation that indicates what changes need to be made by end-users to upgrade.

Lansoweb commented 9 years ago

@weierophinney Hi! Great news. As soon as possible i will create a PR with my solution (the module https://github.com/Lansoweb/LosReCaptcha is working fine and in production by some people).

Lansoweb commented 9 years ago

@weierophinney May i assume just v3 or it's best to create a PR with v2 BC?

weierophinney commented 9 years ago

@Lansoweb I've created a develop branch now to track the next "features" version, which in our case will be ZendService_ReCaptcha v3.0.0, tracking the ReCaptcha API v2.

Give me a few minutes, and I'll also have a repo re-org ready on the develop branch for you to test against (modernizing the toolchain, and getting it in line with other ZF components).

weierophinney commented 9 years ago

@Lansoweb Also, it can break backwards compatibility, as we're targeting a new major version of the component.

Lansoweb commented 9 years ago

@weierophinney Perfect, thanks!

weierophinney commented 9 years ago

@Lansoweb develop now has a PSR-4 structure, and is setup properly with Travis-CI. Have fun!

Lansoweb commented 9 years ago

@weierophinney Ok.

Lansoweb commented 9 years ago

@weierophinney Done at https://github.com/zendframework/ZendService_ReCaptcha/pull/8. We also need changes in ReCaptcha element for Zend\Form and Zend\Captcha\ReCaptcha for use this new service. May I?

fadoe commented 8 years ago

@weierophinney @Lansoweb What is the current status?

Lansoweb commented 8 years ago

@fadoe waiting approval

metanav commented 8 years ago

Still waiting?

Lansoweb commented 8 years ago

@metanav @fadoe Yes, in the meantime, you can try the alternative module https://github.com/Lansoweb/LosReCaptcha

metanav commented 8 years ago

@Lansoweb is there any documentation for Lansoweb/LosReCaptcha or it has same api as ZendService_Recaptcha?

Lansoweb commented 8 years ago

@metanav Mostly the same, just the key names are different to reflect google's API. The following is an example from my zfcuser.global.php:

'form_captcha_options' => [
        'class' => 'LosReCaptcha\Captcha\ReCaptcha',
        'label' => '',
        'attributes' => [
            'id' => 'captcha-input',
        ],
        'options' => [
            'site_key' => 'XXX',
            'secret_key' => 'YYY',
        ],
    ],
metanav commented 8 years ago

I am not using ZfcUser. My configuration for existing Recaptcha is:

    'captcha' => array(
        'class' => 'ReCaptcha',
        'options' => array(
            'privKey' => 'some key',
            'pubKey'  => 'some key 2',
            'theme'   => 'white',
        ),
    )

Are site_key and secret_key same as pubKey and privKey respectively?

olegkrivtsov commented 8 years ago

Any plans to update ZendService_Recaptcha? What's the current status?

demiankatz commented 8 years ago

It seemed like this was on the track to getting merged back in January/February; not sure what happened. In any case, count me as another person who would definitely love to see this made official!

akrabat commented 7 years ago

PR #11 fixes this.

akrabat commented 7 years ago

Version 3.0 released!

Lansoweb commented 7 years ago

Great! Thanks!

akrabat commented 7 years ago

We need Zend-Captcha and Zend-Form updates now… I hope to get to them soon.