Bug 8175 - CSRF token not provided
Summary: CSRF token not provided
Status: VERIFIED FIXED
Alias: None
Product: Toaster
Classification: Build System, Metadata & Runtime
Component: toaster (show other bugs)
Version: 1.9
Hardware: x86 Multiple
: Medium+ major
Target Milestone: 1.9 M3
Assignee: Michael Wood
QA Contact: Cristina Agurida
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2015-08-17 15:26 UTC by Michael Wood
Modified: 2015-09-09 11:37 UTC (History)
5 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Wood 2015-08-17 15:26:59 UTC
Not all pages call the csrf token template function so django does not bother to send it, this means that all subsequent ajax calls fail unless they are marked as csrf exempt. 

"Warning If your view is not rendering a template containing the csrf_token template tag, Django might not set the CSRF token cookie. This is common in cases where forms are dynamically added to the page. To address this case, Django provides a view decorator which forces setting of the cookie: ensure_csrf_cookie(). "

https://docs.djangoproject.com/en/1.8/ref/csrf/#ajax

I think we should add the function call to the base template to make sure that the token is sent, alternative we will need to decorate the views affected.
Comment 2 Cristina Agurida 2015-09-09 11:37:35 UTC
Verified on master: db92bc23880794be77373b0f2d8c26279dcecb84