Bug 8175

Summary: CSRF token not provided
Product: [Build System, Metadata & Runtime] Toaster Reporter: Michael Wood <michael.g.wood>
Component: toasterAssignee: Michael Wood <michael.g.wood>
Status: VERIFIED FIXED QA Contact: Cristina Agurida <cristina-danielax.agurida>
Severity: major    
Priority: Medium+ CC: alexandru.damian, belen.barros.pena, bogdanx.a.voiculescu, cristiana.voicu, jessica.zhang
Version: 1.9   
Target Milestone: 1.9 M3   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

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