Skip to content

Commit fb8c0af

Browse files
author
roman
committed
MAGETWO-61322: Fixed incorrect return-order flow
1 parent be73bf0 commit fb8c0af

File tree

1 file changed

+11
-2
lines changed
  • app/code/Magento/Sales/Controller/AbstractController

1 file changed

+11
-2
lines changed

app/code/Magento/Sales/Controller/AbstractController/Reorder.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
namespace Magento\Sales\Controller\AbstractController;
88

99
use Magento\Framework\App\Action;
10+
use Magento\Framework\Data\Form\FormKey\Validator;
1011
use Magento\Framework\Registry;
1112
use Magento\Framework\Exception\NotFoundException;
1213

@@ -22,18 +23,26 @@ abstract class Reorder extends Action\Action
2223
*/
2324
protected $_coreRegistry;
2425

26+
/**
27+
* @var Validator
28+
*/
29+
private $formKeyValidator;
30+
2531
/**
2632
* @param Action\Context $context
2733
* @param OrderLoaderInterface $orderLoader
2834
* @param Registry $registry
35+
* @param Validator|null $formKeyValidator
2936
*/
3037
public function __construct(
3138
Action\Context $context,
3239
OrderLoaderInterface $orderLoader,
33-
Registry $registry
40+
Registry $registry,
41+
Validator $formKeyValidator = null
3442
) {
3543
$this->orderLoader = $orderLoader;
3644
$this->_coreRegistry = $registry;
45+
$this->formKeyValidator = $formKeyValidator;
3746
parent::__construct($context);
3847
}
3948

@@ -44,7 +53,7 @@ public function __construct(
4453
*/
4554
public function execute()
4655
{
47-
if (!$this->getRequest()->isPost()) {
56+
if (!$this->getRequest()->isPost() || !$this->formKeyValidator->validate($this->getRequest())) {
4857
throw new NotFoundException(__('Page not found.'));
4958
return;
5059
}

0 commit comments

Comments
 (0)