zorab47 / active_admin-sortable_tree

Show ActiveAdmin index as a nested tree with drag'n'drop
MIT License
163 stars 127 forks source link

Fix CSRF InvalidAuthenticityToken #86

Open cprodhomme opened 4 years ago

zorab47 commented 4 years ago

Any worries of raising JS errors if that attribute is missing? How do other plugins solve this problem?

cprodhomme commented 4 years ago

many people speak about put this line skip_before_filter :verify_authenticity_token into their controller but it's a huge mistake because the authenticity token is a random value generated in your view to prove a request is submitted from a form on your site, not somewhere else. This protects against CSRF attacks.

maybe, you need to check before the value $('meta[name=csrf-token]') is not null 🤔