design-in-browser-bootstrap icon indicating copy to clipboard operation
design-in-browser-bootstrap copied to clipboard

Cookie warning atom

Open nicklee opened this issue 7 years ago • 4 comments

Cookie warning feature, requires js-cookie dependency

nicklee avatar Nov 13 '17 16:11 nicklee

It might not be the best place to do this but it would be nice to have this code somewhere too:

if(document.location.pathname == '/'){
  Cookies.remove('csrftoken');
}

People keep using csrf protection on the hompage of wagtail sites, and that completely disables frontend caching on the whole site, which can be a serious problem if there are a lot of visitors in a short period. This fixes that.

Also, I think adding this to DIBB (rather than to wagtail-kit) makes more sense because I guess this way we won't end up importing js-cookie twice.

balazs-endresz avatar Nov 13 '17 16:11 balazs-endresz

@balazs-endresz the DIBB is used for both drupal and wagtail projects, would be cool to add some drupal/wagtail specific things in the future and somehow separate them (default drupal/wagtail form styling comes to mind), but not sure this is in scope at the moment.

Is js-cookie required by wagtail?

nicklee avatar Nov 14 '17 09:11 nicklee

Sure, that makes sense. Also, what wagtail uses is independent from the site itself but we don't include js-cookie in wagtail-kit. I guess I'd just like to be able to use js-cookie in a way that we don't import it twice, and don't accidentally use another similar library in parallel to this. But you're right, this is a bit out of scope here.

balazs-endresz avatar Nov 14 '17 09:11 balazs-endresz

I don't see the harm in including JS cookie stuff here - I'd rather it was merged in and left unused on a few projects than re-implementing it every time it's required. Will review this soon!

siimonevans avatar Nov 16 '17 20:11 siimonevans