Skip to content

Commit ef74144

Browse files
kingjia90dvesh3
authored andcommitted
fix add customer to post and csrf
1 parent 271dd16 commit ef74144

File tree

5 files changed

+11
-3
lines changed

5 files changed

+11
-3
lines changed

frontend/js/functions.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@
9898
return false;
9999
}
100100
$.ajax({
101+
method : 'POST',
101102
url: '/admin/customermanagementframework/customers/new',
103+
headers: {
104+
'X-Pimcore-Csrf-Token': $newCustomerButton.data('token')
105+
},
102106
success: function (data) {
103107
var objectId = data.id;
104108
if ('undefined' !== typeof window.top.pimcore) {

src/Controller/Admin/CustomersController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ public function downloadFinishedExportAction(Request $request): JsonResponse | R
305305
/**
306306
* Create new customer action
307307
*
308-
* @Route("/new")
308+
* @Route("/new", methods={"POST"})
309309
*
310310
* @throws ValidationException
311311
*/

src/Resources/public/admin/js/cmf.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,11 @@ app.SearchFilter.DateRangePicker = (function () {
803803
return false;
804804
}
805805
$.ajax({
806+
method : 'POST',
806807
url: '/admin/customermanagementframework/customers/new',
808+
headers: {
809+
'X-Pimcore-Csrf-Token': $newCustomerButton.data('token')
810+
},
807811
success: function (data) {
808812
var objectId = data.id;
809813
if ('undefined' !== typeof window.top.pimcore) {

0 commit comments

Comments
 (0)