flask-wtf
flask-wtf copied to clipboard
Adding RECAPTCHA_DISABLE to disable recaptcha
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.rstsummarizing the change and linking to the issue. Add.. versionchanged::entries in any relevant code docs.
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?
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')