Configuration¶
|
Set to |
|
When using the CSRF protection extension, this
controls whether every view is protected by default.
Default is |
|
Random data for generating secure tokens. If this is
not set then |
|
HTTP methods to protect from CSRF. Default is
|
|
Name of the form field and session key that holds the
CSRF token. Default is |
|
HTTP headers to search for CSRF token when it is not
provided in the form. Default is
|
|
Value of the |
|
Max age in seconds for CSRF tokens. Default is
|
|
Whether to enforce the same origin policy by checking
that the referrer matches the host. Only applies to
HTTPS requests. Default is |
|
Set to |
Recaptcha¶
|
required A public key. |
|
required A private key. https://www.google.com/recaptcha/admin |
|
Set to |
|
optional A dict of configuration options. |
|
optional Override default HTML template for Recaptcha. |
|
optional A dict of |
|
optional Override the default captcha
script URI in case an alternative service to
reCAPtCHA, e.g. hCaptcha is used. Default is
|
|
optional Override the default class of the
captcha div in case an alternative captcha
service is used. Default is
|
|
optional Override the default verification
server in case an alternative service is used.
Default is
|
Per-instance HTML attributes can also be passed when rendering the field.
Any keyword argument given to the widget is forwarded to the captcha
<div>, following the standard WTForms naming convention (class_
becomes class, data_foo becomes data-foo, aria_label
becomes aria-label). Kwargs take precedence over RECAPTCHA_DIV_CLASS
and RECAPTCHA_DATA_ATTRS. The id attribute defaults to the field
id and can be overridden the same way:
{{ form.recaptcha(class_="my-captcha", data_theme="dark", aria_label="Captcha") }}
Logging¶
CSRF errors are logged at the INFO level to the flask_wtf.csrf logger.
You still need to configure logging in your application in order to see these
messages.