Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any plan to support Invisible ReCaptcha? #281

Open
AbrilRBS opened this issue Feb 13, 2017 · 9 comments
Open

Any plan to support Invisible ReCaptcha? #281

AbrilRBS opened this issue Feb 13, 2017 · 9 comments

Comments

@AbrilRBS
Copy link

Is Invisible ReCaptcha support planned? Would PR with support for it be welcomed?

@davidism davidism reopened this Feb 24, 2017
@davidism
Copy link
Member

davidism commented Feb 24, 2017

Looks like the only change is placing the attributes on a button instead of a div. If you'd like to add an InvisibleRecaptchaWidget and InvisibleRecaptchaSubmit field, that would be fine. I'd prefer to wait until it's out of beta though.

@ar-anvd
Copy link

ar-anvd commented Jun 26, 2017

@davidism It seems out of beta now.

https://developers.google.com/recaptcha/intro

@davidism
Copy link
Member

@ar-anvd @RabsRincon I'd be happy to review a PR if you're still interested.

@mazzer
Copy link

mazzer commented Jul 4, 2017

We started using the Invisible ReCaptcha a while back without having to do any major modifications to our codebase.

flask configuration

RECAPTCHA_DATA_ATTRS = {'bind': 'recaptcha-submit', 'callback': 'onSubmitCallback', 'size': 'invisible'}

controllers.py

from flask_wtf.recaptcha.fields import RecaptchaField
from wtforms.fields.core import StringField


class TestForm(FlaskForm):
    the_input = StringField('Write stuff here...')
    recaptcha = RecaptchaField()


@bp.route('/test', methods=['GET', 'POST'])
def test():
    form = TestForm()

    if form.validate_on_submit():
        print('everything a-ok')
    else:
        print(form.errors)

    return render_template('test.html', form=form)

test.html

<html>
<head></head>
<body>
<script>
    function onSubmitCallback(token) {
        document.getElementById("test-form").submit();
    }
</script>
<form id="test-form" action="" method="post">
    {{ form.the_input }}
    {{ form.recaptcha }}
    <button id="recaptcha-submit">
        Test me
    </button>
</form>
</body>
</html>

@rushilsrivastava
Copy link

I don't think the method that @mazzer shared still works. Is there a better way to set this up?

@fili
Copy link

fili commented May 31, 2020

It still worked for me last week, haven't tried today. Any particular reason why you say it now doesn't work?

@kirtimukh
Copy link

kirtimukh commented Jun 4, 2020

@fili I used the above code for invisible captcha and I get "urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)>" on "form.validate_on_submit"

Edit:
Fixed it by installing Certificates.command

@fili
Copy link

fili commented Jun 4, 2020

@nullbaka Are you using reCaptcha v2: Invisible reCAPTCHA badge? This one works with @mazzer example. I am not sure where that certificate error comes from, may be related to something else or maybe v3.

@kirtimukh
Copy link

@fili yes am using invisible reCAPTCHA on Mac OSX Catalina. I googled the error and found that this issue can be fixed by installing certificates.command. Didn't find any relation to Recaptcha or form validation. All's working good now. Let's see if I face any issues on deployment.

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

No branches or pull requests

8 participants