File tree Expand file tree Collapse file tree 2 files changed +56
-0
lines changed
app/code/Magento/Customer Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+
7
+ namespace Magento \Customer \Model \Plugin ;
8
+
9
+ use Magento \Customer \Model \Session ;
10
+ use Magento \Framework \Data \Form \FormKey as DataFormKey ;
11
+ use Magento \PageCache \Observer \FlushFormKey ;
12
+
13
+ class CustomerFlushFormKey
14
+ {
15
+ /**
16
+ * @var Session
17
+ */
18
+ private $ session ;
19
+
20
+ /**
21
+ * @var DataFormKey
22
+ */
23
+ private $ dataFormKey ;
24
+
25
+ /**
26
+ * Initialize dependencies.
27
+ *
28
+ * @param Session $session
29
+ * @param DataFormKey $dataFormKey
30
+ */
31
+ public function __construct (Session $ session , DataFormKey $ dataFormKey )
32
+ {
33
+ $ this ->session = $ session ;
34
+ $ this ->dataFormKey = $ dataFormKey ;
35
+ }
36
+
37
+ /**
38
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
39
+ * @param FlushFormKey $subject
40
+ * @param callable $proceed
41
+ * @param $args
42
+ */
43
+ public function aroundExecute (FlushFormKey $ subject , callable $ proceed , ...$ args )
44
+ {
45
+ $ currentFormKey = $ this ->dataFormKey ->getFormKey ();
46
+ $ proceed (...$ args );
47
+ $ beforeParams = $ this ->session ->getBeforeRequestParams ();
48
+ if ($ beforeParams ['form_key ' ] == $ currentFormKey ) {
49
+ $ beforeParams ['form_key ' ] = $ this ->dataFormKey ->getFormKey ();
50
+ $ this ->session ->setBeforeRequestParams ($ beforeParams );
51
+ }
52
+ }
53
+ }
Original file line number Diff line number Diff line change 323
323
<type name =" Magento\Framework\App\Action\AbstractAction" >
324
324
<plugin name =" customerNotification" type =" Magento\Customer\Model\Plugin\CustomerNotification" />
325
325
</type >
326
+ <type name =" Magento\PageCache\Observer\FlushFormKey" >
327
+ <plugin name =" customerFlushFormKey" type =" Magento\Customer\Model\Plugin\CustomerFlushFormKey" />
328
+ </type >
326
329
<type name =" Magento\Customer\Model\Customer\NotificationStorage" >
327
330
<arguments >
328
331
<argument name =" cache" xsi : type =" object" >Magento\Customer\Model\Cache\Type\Notification</argument >
You can’t perform that action at this time.
0 commit comments