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..b7b462b3cc317 --- /dev/null +++ b/app/code/Magento/Customer/Model/Plugin/CustomerFlushFormKey.php @@ -0,0 +1,53 @@ +session = $session; + $this->dataFormKey = $dataFormKey; + } + + /** + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @param FlushFormKey $subject + * @param callable $proceed + * @param $args + */ + 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 6eea4e1582a97..40ef730120783 100644 --- a/app/code/Magento/Customer/etc/di.xml +++ b/app/code/Magento/Customer/etc/di.xml @@ -323,6 +323,9 @@ + + + Magento\Customer\Model\Cache\Type\Notification