wagtail / guide

A website to teach Wagtail CMS to content editors, moderators and administrators.
https://guide.wagtail.org
BSD 3-Clause "New" or "Revised" License
32 stars 26 forks source link

Feedback form doesn't work if CSRF token cookie is unset #311

Closed laymonage closed 1 year ago

laymonage commented 1 year ago

If a new visitor visits the website without encountering any forms/page that includes a CSRF token, the CSRF token cookie is never set. Meanwhile, we rely on the cookie to handle the processing of the feedback form: https://github.com/wagtail/guide/blob/main/apps/frontend/static_src/js/feedback/index.js

but, no CSRF token is rendered in the HTML:

https://github.com/wagtail/guide/blob/main/apps/core/templates/components/feedback.html

Thus, the feedback form doesn't work, unless you've visited a page with a form that includes the CSRF token (e.g. /admin/)