flask-wtf icon indicating copy to clipboard operation
flask-wtf copied to clipboard

Adding RECAPTCHA_DISABLE to disable recaptcha

Open rnt opened this issue 3 years ago • 2 comments

This pull request allows you to use forms, without commenting on the recaptcha field when you are offline.

It's #214 but more than 6 years later. ;)

  • fixes #

Checklist:

  • [ ] Add tests that demonstrate the correct behavior of the change. Tests should fail without the change.
  • [x] Add or update relevant docs, in the docs folder and in code.
  • [ ] Add an entry in docs/changes.rst summarizing the change and linking to the issue. Add .. versionchanged:: entries in any relevant code docs.

rnt avatar Mar 10 '22 01:03 rnt

Thank you for your contribution. This looks OK to me. However I am wondering if RECAPTCHA_ENABLED with a default to True would not be better, to match with the other configuration vars (WTF_CSRF_ENABLED and WTF_I18N_ENABLED).

What do you think?

azmeuk avatar Jan 13 '23 14:01 azmeuk

Perhaps as an alternative or for in the documentation, simply use:

if not app.debug:
    app.config['RECAPTCHA_PUBLIC_KEY'] = ...
    app.config['RECAPTCHA_PRIVATE_KEY'] = ...
    ...


    ...
    if not app.debug:
        recaptcha = RecaptchaField()
    submit = SubmitField('Submit')

PanderMusubi avatar Jan 08 '24 23:01 PanderMusubi