diff --git a/app/code/Magento/Customer/Model/Plugin/CustomerFlushFormKey.php b/app/code/Magento/Customer/Model/Plugin/CustomerFlushFormKey.php new file mode 100644 index 0000000000000..0d5b084df30e3 --- /dev/null +++ b/app/code/Magento/Customer/Model/Plugin/CustomerFlushFormKey.php @@ -0,0 +1,52 @@ +session = $session; + $this->dataFormKey = $dataFormKey; + } + + /** + * @param FlushFormKey $subject + * @param callable $proceed + * @param array $args + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function aroundExecute(FlushFormKey $subject, callable $proceed, ...$args) + { + $currentFormKey = $this->dataFormKey->getFormKey(); + $proceed(...$args); + $beforeParams = $this->session->getBeforeRequestParams(); + if ($beforeParams['form_key'] == $currentFormKey) { + $beforeParams['form_key'] = $this->dataFormKey->getFormKey(); + $this->session->setBeforeRequestParams($beforeParams); + } + } +} diff --git a/app/code/Magento/Customer/etc/di.xml b/app/code/Magento/Customer/etc/di.xml index 48e02e6d030f2..5b33328bb176d 100644 --- a/app/code/Magento/Customer/etc/di.xml +++ b/app/code/Magento/Customer/etc/di.xml @@ -313,6 +313,9 @@ + + + Magento\Customer\Model\Cache\Type\Notification