Does Flask-WTF support reCAPTCHA v3?
Asked Answered
C

1

6

I have been trying to integrate Google reCAPTCHA v3 to a website through the RecaptchaField provided by Flask-WTF. I know that reCAPTCHA v3 is newly introduced by Google and I am wondering if Flask-WTF support it or not?

To clarify : recaptcha v2 is supported. The question is, if recaptcha v3 is supported as well

Cappadocia answered 21/12, 2018 at 18:12 Comment(0)
M
1

please have a look at Flask-Recaptcha which also support V3 from Google: https://github.com/rlid/flask-recaptcha

You can create Recaptcha fields like this:

class Recaptcha3Form(FlaskForm):
    message = TextField(label="Message")
    recaptcha = Recaptcha3Field(action="TestAction", execute_on_load=True)
    submit = SubmitField(label="Submit")

and render it like this:

@app.route("/v3", methods=["GET", "POST"])
def v3():
    form = Recaptcha3Form()
    if form.validate_on_submit():
        form.message.data = "[Success]" + form.message.data
    return render_template("demo.html", form=form)

Please note: I copied the code from the from flask recaptcha documentation

Muire answered 6/12, 2019 at 14:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.