Skip to content

Commit 14244c1

Browse files
authored
[Fix] CSRF Protection is safe again and don't need to be disabled for the import route (#9)
1 parent 1b5487a commit 14244c1

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

README.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,8 @@ In the same way you can re-import your yaml file again by selecting: `Import fro
5252
## Configuration
5353

5454
### Page Import
55-
To use the Page Importer, the CSRF protection for the PageImportController route must be avoided.
5655

57-
To do this, create a file `config/packages/pimcore_admin.yaml` and add the following content:
58-
59-
```yaml
60-
pimcore_admin:
61-
csrf_protection:
62-
excluded_routes:
63-
- neusta_pimcore_import_export_page_import
64-
```
56+
The import process will create a new page with the given data.
6557

6658
## Contribution
6759

public/js/importPage.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ neusta_pimcore_import_export.plugin.page.import = Class.create({
5454
headers: {
5555
'X-Requested-With': 'XMLHttpRequest' // ✅ important for AJAX-Requests
5656
},
57+
params: {
58+
'csrfToken': parent.pimcore.settings["csrfToken"]
59+
},
5760
success: function (form, action) {
5861
let response = Ext.decode(action.response.responseText);
5962
pimcore.helpers.showNotification(t('neusta_pimcore_import_export_import_dialog_notification_success'), response.message, 'success');

0 commit comments

Comments
 (0)