WTforms form not submitting but outputs no validation errors

筅森魡賤 提交于 2019-12-03 09:01:28

You have csrf_enabled=True but your form doesn't have any CSRF protection since you aren't inheriting from SecureForm. If you want to enable CSRF, read the documentation and update your form definition.

If this was unintended, you can remove csrf_enabled=True and your logic will work as expected.

To enable CSRF protection, there are a few steps:

  1. Inherit from SecureForm
  2. Create the generate_csrf_token and validate_csrf_token methods in your form. These methods will generate a unique key and raise errors when it doesn't validate.
  3. Add {{ form.csrf_token }} to your template.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!