Skip to content

Commit e98229e

Browse files
author
Volodymyr Kublytskyi
committed
Merge magento/magento2ce/develop into magento-partners/magento2ce/develop-instant-purchase
2 parents 689562d + 14b165e commit e98229e

File tree

59 files changed

+899
-101
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+899
-101
lines changed

app/code/Magento/CatalogSearch/etc/indexer.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
<indexer id="catalogsearch_fulltext" view_id="catalogsearch_fulltext" class="Magento\CatalogSearch\Model\Indexer\Fulltext">
1010
<title translate="true">Catalog Search</title>
1111
<description translate="true">Rebuild Catalog product fulltext search index</description>
12-
13-
<saveHandler class="Magento\CatalogSearch\Model\Indexer\IndexHandler" />
1412
<structure class="Magento\CatalogSearch\Model\Indexer\IndexStructure" />
1513
</indexer>
1614
</config>

app/code/Magento/Cms/Model/ResourceModel/Block.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,10 @@ public function getIsUniqueBlockToStores(AbstractModel $object)
183183
$entityMetadata = $this->metadataPool->getMetadata(BlockInterface::class);
184184
$linkField = $entityMetadata->getLinkField();
185185

186-
if ($this->_storeManager->hasSingleStore()) {
186+
if ($this->_storeManager->isSingleStoreMode()) {
187187
$stores = [Store::DEFAULT_STORE_ID];
188188
} else {
189-
$stores = (array)$object->getData('stores');
189+
$stores = (array)$object->getData('store_id');
190190
}
191191

192192
$select = $this->getConnection()->select()
@@ -230,7 +230,7 @@ public function lookupStoreIds($id)
230230
'cbs.' . $linkField . ' = cb.' . $linkField,
231231
[]
232232
)
233-
->where('cb.' . $entityMetadata->getIdentifierField() . ' = :block_id');
233+
->where('cb.' . $entityMetadata->getIdentifierField() . ' = :block_id');
234234

235235
return $connection->fetchCol($select, ['block_id' => (int)$id]);
236236
}

app/code/Magento/Sales/Model/AdminOrder/Create.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1907,6 +1907,7 @@ public function createOrder()
19071907
$oldOrder = $this->getSession()->getOrder();
19081908
$oldOrder->setRelationChildId($order->getId());
19091909
$oldOrder->setRelationChildRealId($order->getIncrementId());
1910+
$oldOrder->save();
19101911
$this->orderManagement->cancel($oldOrder->getEntityId());
19111912
$order->save();
19121913
}

app/code/Magento/Sales/view/adminhtml/ui_component/sales_order_grid.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@
139139
<settings>
140140
<filter>text</filter>
141141
<label translate="true">ID</label>
142-
<sorting>desc</sorting>
143142
</settings>
144143
</column>
145144
<column name="store_id" class="Magento\Store\Ui\Component\Listing\Column\Store">
@@ -154,6 +153,7 @@
154153
<filter>dateRange</filter>
155154
<dataType>date</dataType>
156155
<label translate="true">Purchase Date</label>
156+
<sorting>desc</sorting>
157157
</settings>
158158
</column>
159159
<column name="billing_name">

app/code/Magento/Security/Model/Config.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,17 @@ class Config implements ConfigInterface
2424
*/
2525
const XML_PATH_ADMIN_AREA = 'admin/security/';
2626

27+
/**
28+
* Configuration path to frontend area
29+
*/
30+
const XML_PATH_FRONTEND_AREA = 'customer/password/';
31+
2732
/**
2833
* Configuration path to fronted area
34+
* @deprecated
35+
* @see \Magento\Security\Model\Config::XML_PATH_FRONTEND_AREA
2936
*/
30-
const XML_PATH_FRONTED_AREA = 'customer/password/';
37+
const XML_PATH_FRONTED_AREA = self::XML_PATH_FRONTEND_AREA;
3138

3239
/**
3340
* Configuration path to admin account sharing
@@ -134,7 +141,7 @@ protected function getXmlPathPrefix()
134141
if ($this->scope->getCurrentScope() == \Magento\Framework\App\Area::AREA_ADMINHTML) {
135142
return self::XML_PATH_ADMIN_AREA;
136143
}
137-
return self::XML_PATH_FRONTED_AREA;
144+
return self::XML_PATH_FRONTEND_AREA;
138145
}
139146

140147
/**

app/code/Magento/Security/Model/Plugin/AccountManagement.php

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
*/
66
namespace Magento\Security\Model\Plugin;
77

8-
use Magento\Security\Model\SecurityManager;
98
use Magento\Customer\Model\AccountManagement as AccountManagementOriginal;
9+
use Magento\Framework\App\ObjectManager;
10+
use Magento\Framework\Config\ScopeInterface;
1011
use Magento\Framework\Exception\SecurityViolationException;
1112
use Magento\Security\Model\PasswordResetRequestEvent;
13+
use Magento\Security\Model\SecurityManager;
1214

1315
/**
1416
* Magento\Customer\Model\AccountManagement decorator
@@ -30,21 +32,29 @@ class AccountManagement
3032
*/
3133
protected $passwordRequestEvent;
3234

35+
/**
36+
* @var ScopeInterface
37+
*/
38+
private $scope;
39+
3340
/**
3441
* AccountManagement constructor.
3542
*
3643
* @param \Magento\Framework\App\RequestInterface $request
3744
* @param SecurityManager $securityManager
3845
* @param int $passwordRequestEvent
46+
* @param ScopeInterface $scope
3947
*/
4048
public function __construct(
4149
\Magento\Framework\App\RequestInterface $request,
4250
\Magento\Security\Model\SecurityManager $securityManager,
43-
$passwordRequestEvent = PasswordResetRequestEvent::CUSTOMER_PASSWORD_RESET_REQUEST
51+
$passwordRequestEvent = PasswordResetRequestEvent::CUSTOMER_PASSWORD_RESET_REQUEST,
52+
ScopeInterface $scope = null
4453
) {
4554
$this->request = $request;
4655
$this->securityManager = $securityManager;
4756
$this->passwordRequestEvent = $passwordRequestEvent;
57+
$this->scope = $scope ?: ObjectManager::getInstance()->get(ScopeInterface::class);
4858
}
4959

5060
/**
@@ -63,10 +73,14 @@ public function beforeInitiatePasswordReset(
6373
$template,
6474
$websiteId = null
6575
) {
66-
$this->securityManager->performSecurityCheck(
67-
$this->passwordRequestEvent,
68-
$email
69-
);
76+
if ($this->scope->getCurrentScope() == \Magento\Framework\App\Area::AREA_FRONTEND
77+
|| $this->passwordRequestEvent == PasswordResetRequestEvent::ADMIN_PASSWORD_RESET_REQUEST) {
78+
$this->securityManager->performSecurityCheck(
79+
$this->passwordRequestEvent,
80+
$email
81+
);
82+
}
83+
7084
return [$email, $template, $websiteId];
7185
}
7286
}

app/code/Magento/Security/Test/Unit/Model/ConfigTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ protected function getXmlPathPrefix($scope)
167167
if ($scope == \Magento\Framework\App\Area::AREA_ADMINHTML) {
168168
return \Magento\Security\Model\Config::XML_PATH_ADMIN_AREA;
169169
}
170-
return \Magento\Security\Model\Config::XML_PATH_FRONTED_AREA;
170+
return \Magento\Security\Model\Config::XML_PATH_FRONTEND_AREA;
171171
}
172172

173173
/**

app/code/Magento/Security/Test/Unit/Model/Plugin/AccountManagementTest.php

Lines changed: 48 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66

77
namespace Magento\Security\Test\Unit\Model\Plugin;
88

9+
use Magento\Customer\Model\AccountManagement;
10+
use Magento\Framework\App\Area;
11+
use Magento\Framework\Config\ScopeInterface;
912
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
13+
use Magento\Security\Model\PasswordResetRequestEvent;
1014

1115
/**
1216
* Test class for \Magento\Security\Model\Plugin\AccountManagement testing
@@ -19,20 +23,25 @@ class AccountManagementTest extends \PHPUnit\Framework\TestCase
1923
protected $model;
2024

2125
/**
22-
* @var \Magento\Framework\App\RequestInterface
26+
* @var \Magento\Framework\App\RequestInterface|\PHPUnit_Framework_MockObject_MockObject
2327
*/
2428
protected $request;
2529

2630
/**
27-
* @var \Magento\Security\Model\SecurityManager
31+
* @var \Magento\Security\Model\SecurityManager|\PHPUnit_Framework_MockObject_MockObject
2832
*/
2933
protected $securityManager;
3034

3135
/**
32-
* @var \Magento\Customer\Model\AccountManagement
36+
* @var AccountManagement|\PHPUnit_Framework_MockObject_MockObject
3337
*/
3438
protected $accountManagement;
3539

40+
/**
41+
* @var ScopeInterface|\PHPUnit_Framework_MockObject_MockObject
42+
*/
43+
private $scope;
44+
3645
/**
3746
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
3847
*/
@@ -53,28 +62,38 @@ public function setUp()
5362
['performSecurityCheck']
5463
);
5564

56-
$this->accountManagement = $this->createMock(\Magento\Customer\Model\AccountManagement::class);
65+
$this->accountManagement = $this->createMock(AccountManagement::class);
66+
$this->scope = $this->createMock(ScopeInterface::class);
67+
}
68+
69+
/**
70+
* @param $area
71+
* @param $passwordRequestEvent
72+
* @param $expectedTimes
73+
* @dataProvider beforeInitiatePasswordResetDataProvider
74+
*/
75+
public function testBeforeInitiatePasswordReset($area, $passwordRequestEvent, $expectedTimes)
76+
{
77+
$email = 'test@example.com';
78+
$template = AccountManagement::EMAIL_RESET;
5779

5880
$this->model = $this->objectManager->getObject(
5981
\Magento\Security\Model\Plugin\AccountManagement::class,
6082
[
83+
'passwordRequestEvent' => $passwordRequestEvent,
6184
'request' => $this->request,
62-
'securityManager' => $this->securityManager
85+
'securityManager' => $this->securityManager,
86+
'scope' => $this->scope
6387
]
6488
);
65-
}
6689

67-
/**
68-
* @return void
69-
*/
70-
public function testBeforeInitiatePasswordReset()
71-
{
72-
$email = 'test@example.com';
73-
$template = \Magento\Customer\Model\AccountManagement::EMAIL_RESET;
90+
$this->scope->expects($this->once())
91+
->method('getCurrentScope')
92+
->willReturn($area);
7493

75-
$this->securityManager->expects($this->once())
94+
$this->securityManager->expects($this->exactly($expectedTimes))
7695
->method('performSecurityCheck')
77-
->with(\Magento\Security\Model\PasswordResetRequestEvent::CUSTOMER_PASSWORD_RESET_REQUEST, $email)
96+
->with($passwordRequestEvent, $email)
7897
->willReturnSelf();
7998

8099
$this->model->beforeInitiatePasswordReset(
@@ -83,4 +102,18 @@ public function testBeforeInitiatePasswordReset()
83102
$template
84103
);
85104
}
105+
106+
/**
107+
* @return array
108+
*/
109+
public function beforeInitiatePasswordResetDataProvider()
110+
{
111+
return [
112+
[Area::AREA_ADMINHTML, PasswordResetRequestEvent::CUSTOMER_PASSWORD_RESET_REQUEST, 0],
113+
[Area::AREA_ADMINHTML, PasswordResetRequestEvent::ADMIN_PASSWORD_RESET_REQUEST, 1],
114+
[Area::AREA_FRONTEND, PasswordResetRequestEvent::CUSTOMER_PASSWORD_RESET_REQUEST, 1],
115+
// This should never happen, but let's cover it with tests
116+
[Area::AREA_FRONTEND, PasswordResetRequestEvent::ADMIN_PASSWORD_RESET_REQUEST, 1],
117+
];
118+
}
86119
}

app/code/Magento/Security/etc/adminhtml/di.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</type>
1818
<type name="Magento\Security\Model\Plugin\AccountManagement">
1919
<arguments>
20-
<argument name="passwordRequestEvent" xsi:type="const">Magento\Security\Model\PasswordResetRequestEvent::ADMIN_PASSWORD_RESET_REQUEST</argument>
20+
<argument name="passwordRequestEvent" xsi:type="const">Magento\Security\Model\PasswordResetRequestEvent::CUSTOMER_PASSWORD_RESET_REQUEST</argument>
2121
</arguments>
2222
</type>
2323
<type name="Magento\Security\Model\SecurityManager">

0 commit comments

Comments
 (0)