File tree Expand file tree Collapse file tree 2 files changed +55
-0
lines changed
app/code/Magento/Customer Expand file tree Collapse file tree 2 files changed +55
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © 2013-2017 Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+ namespace Magento \Customer \Model \Plugin ;
7
+
8
+ use Magento \Customer \Model \Session ;
9
+ use Magento \Framework \Data \Form \FormKey as DataFormKey ;
10
+ use Magento \PageCache \Observer \FlushFormKey ;
11
+
12
+ class CustomerFlushFormKey
13
+ {
14
+ /**
15
+ * @var Session
16
+ */
17
+ private $ session ;
18
+
19
+ /**
20
+ * @var DataFormKey
21
+ */
22
+ private $ dataFormKey ;
23
+
24
+ /**
25
+ * Initialize dependencies.
26
+ *
27
+ * @param Session $session
28
+ * @param DataFormKey $dataFormKey
29
+ */
30
+ public function __construct (Session $ session , DataFormKey $ dataFormKey )
31
+ {
32
+ $ this ->session = $ session ;
33
+ $ this ->dataFormKey = $ dataFormKey ;
34
+ }
35
+
36
+ /**
37
+ * @param FlushFormKey $subject
38
+ * @param callable $proceed
39
+ * @param array $args
40
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
41
+ */
42
+ public function aroundExecute (FlushFormKey $ subject , callable $ proceed , ...$ args )
43
+ {
44
+ $ currentFormKey = $ this ->dataFormKey ->getFormKey ();
45
+ $ proceed (...$ args );
46
+ $ beforeParams = $ this ->session ->getBeforeRequestParams ();
47
+ if ($ beforeParams ['form_key ' ] == $ currentFormKey ) {
48
+ $ beforeParams ['form_key ' ] = $ this ->dataFormKey ->getFormKey ();
49
+ $ this ->session ->setBeforeRequestParams ($ beforeParams );
50
+ }
51
+ }
52
+ }
Original file line number Diff line number Diff line change 313
313
<type name =" Magento\Framework\App\Action\AbstractAction" >
314
314
<plugin name =" customerNotification" type =" Magento\Customer\Model\Plugin\CustomerNotification" />
315
315
</type >
316
+ <type name =" Magento\PageCache\Observer\FlushFormKey" >
317
+ <plugin name =" customerFlushFormKey" type =" Magento\Customer\Model\Plugin\CustomerFlushFormKey" />
318
+ </type >
316
319
<type name =" Magento\Customer\Model\Customer\NotificationStorage" >
317
320
<arguments >
318
321
<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