Skip to content

Commit

Permalink
add CSRF protection token
Browse files Browse the repository at this point in the history
  • Loading branch information
ebrehault committed Feb 26, 2015
1 parent 265fc25 commit d37d552
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Changelog
- Update markup and javscript for Plone 5.
[davisagli]

- Add CSRF protection token
[ebrehault]

2.0.1 (2014-10-23)
------------------
Expand Down
1 change: 1 addition & 0 deletions plone/schemaeditor/browser/schema/schema_listing.pt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

<metal:form metal:use-macro="context/@@ploneform-macros/form">
<metal:top-slot metal:fill-slot="formtop">
<input tal:replace="structure context/@@authenticator/authenticator" />
<script type="text/javascript"
tal:attributes="src context/++resource++schemaeditor.js"></script>
<style type="text/css">
Expand Down
10 changes: 8 additions & 2 deletions plone/schemaeditor/browser/schema/schemaeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,20 +139,26 @@
if (!confirm(trigger.attr('data-confirm_msg'))) {
return;
}
$.post(trigger.attr('href'), null, function (data) {
$.post(trigger.attr('href'), {
_authenticator: $('input[name="_authenticator"]').val(),
}, function (data) {
trigger.closest('.fieldPreview').detach();
}, 'text');
});
// reorder fields and change fieldsets
$('.fieldPreview.orderable').plone_schemaeditor_html5_sortable(function (position, fieldset_index) {
var url = window.location.href.replace('/@@fields', '') + '/' + this.attr('data-field_id') + '/@@order';
$.post(url, {
_authenticator: $('input[name="_authenticator"]').val(),
pos: position,
fieldset_index: fieldset_index
});
}, function (fieldset_index) {
var url = window.location.href.replace('/@@fields', '') + '/' + this.attr('data-field_id') + '/@@changefieldset';
$.post(url, { fieldset_index: fieldset_index });
$.post(url, {
_authenticator: $('input[name="_authenticator"]').val(),
fieldset_index: fieldset_index
});
});
set_id_from_title = function () {
var id = $.plone_schemaeditor_normalize_string($(this).val());
Expand Down

0 comments on commit d37d552

Please sign in to comment.