pallets-eco/flask-wtf

Inconsistency with raising CSRFError

开放

#381 创建于 2019年10月18日

 (2 条评论) (0 个反应) (0 位负责人)Python (315 个派生)github user discovery
csrfdocsgood first issue

仓库指标

星标
 (1,508 个星标)
PR 合并指标
 (平均合并 3小时 45分钟) (30 天内合并 3 个 PR)

描述

The Flask-WTF docs state:

When CSRF validation fails, it will raise a CSRFError.

However, this appears to only be true, if this optional code has been used:

from flask_wtf.csrf import CSRFProtect
csrf = CSRFProtect(app)

When that code is not used, forms are created by subclassing FlaskForm, and CSRF validation fails, then validate_on_submit returns False instead of raising CSRFError.

It seems that ideally you would always raise CSRFError for consistency, but if you don't want to do that, then it would be helpful to update the docs.

贡献者指南