Skip to content

Commit 7bf6f18

Browse files
committed
MAGETWO-97947: Invalid action behavior
1 parent 5d6dd2a commit 7bf6f18

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

app/code/Magento/Customer/Controller/Adminhtml/Index/ResetPassword.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function execute()
1919
{
2020
$resultRedirect = $this->resultRedirectFactory->create();
2121
$customerId = (int)$this->getRequest()->getParam('customer_id', 0);
22-
if (!$this->getRequest()->isPost() || !$customerId) {
22+
if (!$customerId) {
2323
$resultRedirect->setPath('customer/index');
2424
return $resultRedirect;
2525
}

app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/ResetPasswordTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ protected function setUp()
9797
$this->_request = $this->getMockBuilder(\Magento\Framework\App\Request\Http::class)
9898
->disableOriginalConstructor()
9999
->getMock();
100-
$this->_request->expects($this->any())->method('isPost')->willReturn(true);
101100

102101
$this->_response = $this->getMockBuilder(
103102
\Magento\Framework\App\Response\Http::class

app/code/Magento/Customer/view/frontend/web/js/address.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
define([
77
'jquery',
88
'Magento_Ui/js/modal/confirm',
9+
'mage/dataPost',
910
'jquery/ui',
1011
'mage/translate'
11-
], function ($, confirm) {
12+
], function ($, confirm, dataPost) {
1213
'use strict';
1314

1415
$.widget('mage.address', {
@@ -53,7 +54,8 @@ define([
5354
* @return {Boolean}
5455
*/
5556
_deleteAddress: function (e) {
56-
var self = this;
57+
var self = this,
58+
addressId;
5759

5860
confirm({
5961
content: this.options.deleteConfirmMessage,
@@ -62,12 +64,15 @@ define([
6264
/** @inheritdoc */
6365
confirm: function () {
6466
if (typeof $(e.target).parent().data('address') !== 'undefined') {
65-
window.location = self.options.deleteUrlPrefix + $(e.target).parent().data('address') +
66-
'/form_key/' + $.mage.cookies.get('form_key');
67+
addressId = $(e.target).parent().data('address');
6768
} else {
68-
window.location = self.options.deleteUrlPrefix + $(e.target).data('address') +
69-
'/form_key/' + $.mage.cookies.get('form_key');
69+
addressId = $(e.target).data('address');
7070
}
71+
72+
dataPost().postData({
73+
action: self.options.deleteUrlPrefix + addressId,
74+
data: { form_key: $.mage.cookies.get('form_key') }
75+
});
7176
}
7277
}
7378
});

0 commit comments

Comments
 (0)