Skip to content

Conversation

@felipou
Copy link

@felipou felipou commented Aug 28, 2015

I got the version 2 implementation from hgGeorg's fork (https://github.com/hgGeorg/node-recaptcha/blob/master/lib/recaptcha.js)
and inserted it here but keeping the lib backwards compatible so
it is possible to make a smooth transition, or even support both
versions in the same code.

I got the version 2 implementation from hgGeorg's fork (https://github.com/hgGeorg/node-recaptcha/blob/master/lib/recaptcha.js)
and inserted it here but keeping the lib backwards compatible so
it is possible to make a smooth transition, or even support both
versions in the same code.
@superclarkk
Copy link

Please can someone let me know when this is likely to be merged? Thanks

@Sommerfeld
Copy link

is it possible that u might mix up some callback parameters in the verify method? (success, errorMessage)

@felipou
Copy link
Author

felipou commented Feb 12, 2016

@Sommerfeld Sorry, I didn't understand what you want. Also, I didn't write any of this code, I just merged the codes for both versions.

@Sommerfeld
Copy link

/lib/v2.js

Recaptcha.prototype.verify = function(callback) {
    var self = this;

    // See if we can declare this invalid without even contacting Recaptcha.
    if (typeof(this.data) === 'undefined') {
        this.error_code = 'verify-params-incorrect';
        return callback('verify-params-incorrect', false); // (errorMessage, succes)
    }
    if (!('remoteip' in this.data &&
          'response' in this.data))
    {
        this.error_code = 'verify-params-incorrect';
        return callback(false, 'verify-params-incorrect'); // (success, errorMessage)
    }
    if (this.data.response === '') {
        this.error_code = 'incorrect-captcha-sol';
        return callback('incorrect-captcha-sol', false); // (errorMessage, succes)
    }
   ...
};

If i'm correct after checking /lib/v1.js it should always be (succes, errorMessage). It's not important for me just got confused when i read the code. So if I'm wrong just ignore me:)

@superclarkk
Copy link

Just in case anyone needs it, I'm using recaptcha2 now, and it works really well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants