Skip to content

Commit fe7b09f

Browse files
committed
Merge branch 'develop' of github.corp.magento.com:magento2/magento2ce into MAGETWO-49446
2 parents e5bfa9a + fb909a9 commit fe7b09f

File tree

394 files changed

+14837
-1984
lines changed

Some content is hidden

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

394 files changed

+14837
-1984
lines changed

app/code/Magento/Backend/Controller/Adminhtml/System/Account/Save.php

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,27 @@
99
use Magento\Framework\Exception\AuthenticationException;
1010
use Magento\Framework\Exception\LocalizedException;
1111
use Magento\Framework\Controller\ResultFactory;
12+
use Magento\Framework\Exception\State\UserLockedException;
1213

1314
class Save extends \Magento\Backend\Controller\Adminhtml\System\Account
1415
{
16+
/**
17+
* @var \Magento\Security\Helper\SecurityCookie
18+
*/
19+
protected $securityCookieHelper;
20+
21+
/**
22+
* @param \Magento\Backend\App\Action\Context $context
23+
* @param \Magento\Security\Helper\SecurityCookie $securityCookieHelper
24+
*/
25+
public function __construct(
26+
\Magento\Backend\App\Action\Context $context,
27+
\Magento\Security\Helper\SecurityCookie $securityCookieHelper
28+
) {
29+
parent::__construct($context);
30+
$this->securityCookieHelper = $securityCookieHelper;
31+
}
32+
1533
/**
1634
* Saving edited user information
1735
*
@@ -43,21 +61,22 @@ public function execute()
4361
/** Before updating admin user data, ensure that password of current admin user is entered and is correct */
4462
$currentUserPasswordField = \Magento\User\Block\User\Edit\Tab\Main::CURRENT_USER_PASSWORD_FIELD;
4563
$currentUserPassword = $this->getRequest()->getParam($currentUserPasswordField);
46-
$isCurrentUserPasswordValid = !empty($currentUserPassword) && is_string($currentUserPassword);
4764
try {
48-
if (!($isCurrentUserPasswordValid && $user->verifyIdentity($currentUserPassword))) {
49-
throw new AuthenticationException(__('You have entered an invalid password for current user.'));
50-
}
65+
$user->performIdentityCheck($currentUserPassword);
5166
if ($password !== '') {
5267
$user->setPassword($password);
5368
$user->setPasswordConfirmation($passwordConfirmation);
5469
}
5570
$user->save();
56-
/** Send password reset email notification only when password was changed */
57-
if ($password !== '') {
58-
$user->sendPasswordResetNotificationEmail();
59-
}
71+
72+
$user->sendNotificationEmailsIfRequired();
73+
6074
$this->messageManager->addSuccess(__('You saved the account.'));
75+
} catch (UserLockedException $e) {
76+
$this->_auth->logout();
77+
$this->securityCookieHelper->setLogoutReasonCookie(
78+
\Magento\Security\Model\AdminSessionsManager::LOGOUT_REASON_USER_LOCKED
79+
);
6180
} catch (ValidatorException $e) {
6281
$this->messageManager->addMessages($e->getMessages());
6382
if ($e->getMessage()) {

app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/System/Account/SaveTest.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ class SaveTest extends \PHPUnit_Framework_TestCase
4242
/** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\TranslateInterface */
4343
protected $_translatorMock;
4444

45+
/** @var \PHPUnit_Framework_MockObject_MockObject |\Magento\Framework\Event\ManagerInterface */
46+
protected $eventManagerMock;
47+
4548
protected function setUp()
4649
{
4750
$this->_requestMock = $this->getMockBuilder('Magento\Framework\App\Request\Http')
@@ -76,7 +79,7 @@ protected function setUp()
7679
$this->_userMock = $this->getMockBuilder('Magento\User\Model\User')
7780
->disableOriginalConstructor()
7881
->setMethods(
79-
['load', 'save', 'sendPasswordResetNotificationEmail', 'verifyIdentity', '__sleep', '__wakeup']
82+
['load', 'save', 'sendNotificationEmailsIfRequired', 'performIdentityCheck', '__sleep', '__wakeup']
8083
)
8184
->getMock();
8285

@@ -190,10 +193,9 @@ public function testSaveAction()
190193
);
191194

192195
$this->_userMock->setUserId($userId);
193-
196+
$this->_userMock->expects($this->once())->method('performIdentityCheck')->will($this->returnValue(true));
194197
$this->_userMock->expects($this->once())->method('save');
195-
$this->_userMock->expects($this->once())->method('verifyIdentity')->will($this->returnValue(true));
196-
$this->_userMock->expects($this->once())->method('sendPasswordResetNotificationEmail');
198+
$this->_userMock->expects($this->once())->method('sendNotificationEmailsIfRequired');
197199

198200
$this->_requestMock->setParams($requestParams);
199201

app/code/Magento/Backend/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"magento/module-quote": "100.0.*",
1414
"magento/module-catalog": "100.0.*",
1515
"magento/module-user": "100.0.*",
16+
"magento/module-security": "100.0.*",
1617
"magento/module-backup": "100.0.*",
1718
"magento/module-customer": "100.0.*",
1819
"magento/module-translation": "100.0.*",

app/code/Magento/Backend/etc/adminhtml/system.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -368,12 +368,6 @@
368368
<label>Forgot and Reset Email Sender</label>
369369
<source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model>
370370
</field>
371-
<field id="password_reset_link_expiration_period" translate="label comment" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0">
372-
<label>Recovery Link Expiration Period (days)</label>
373-
<comment>Please enter a number 1 or greater in this field.</comment>
374-
<validate>required-entry integer validate-greater-than-zero</validate>
375-
<backend_model>Magento\Config\Model\Config\Backend\Admin\Password\Link\Expirationperiod</backend_model>
376-
</field>
377371
</group>
378372
<group id="startup" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0">
379373
<label>Startup Page</label>
@@ -414,6 +408,12 @@
414408
</group>
415409
<group id="security" translate="label" type="text" sortOrder="35" showInDefault="1" showInWebsite="0" showInStore="0">
416410
<label>Security</label>
411+
<field id="password_reset_link_expiration_period" translate="label comment" type="text" sortOrder="7" showInDefault="1" showInWebsite="0" showInStore="0">
412+
<label>Recovery Link Expiration Period (hours)</label>
413+
<comment>Please enter a number 1 or greater in this field.</comment>
414+
<validate>required-entry integer validate-greater-than-zero</validate>
415+
<backend_model>Magento\Config\Model\Config\Backend\Admin\Password\Link\Expirationperiod</backend_model>
416+
</field>
417417
<field id="use_form_key" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
418418
<label>Add Secret Key to URLs</label>
419419
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>

app/code/Magento/Backend/view/adminhtml/templates/system/search.phtml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,19 @@
2727
</form>
2828
<script data-template="search-suggest" type="text/x-magento-template">
2929
<ul class="search-global-menu">
30-
<% if (data.items.length) { %>
30+
<li class="item">
31+
<a href="<?php /* @escapeNotVerified */ echo $block->getURL('catalog/product/index/'); ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Products</a>
32+
</li>
33+
<li class="item">
34+
<a href="<?php /* @escapeNotVerified */ echo $block->getURL('sales/order/index/'); ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Orders</a>
35+
</li>
36+
<li class="item">
37+
<a href="<?php /* @escapeNotVerified */ echo $block->getURL('customer/index/index/'); ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Customers</a>
38+
</li>
39+
<li class="item">
40+
<a href="<?php /* @escapeNotVerified */ echo $block->getURL('cms/page/index/'); ?>?search=<%- data.term%>" class="title">"<%- data.term%>" in Pages</a>
41+
</li>
42+
<% if (data.items.length) { %>
3143
<% _.each(data.items, function(value){ %>
3244
<li class="item"
3345
<%- data.optionData(value) %>

app/code/Magento/BraintreeTwo/Test/Unit/Gateway/Http/Client/TransactionSubmitForSettlementTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function testPlaceRequestWithException()
6969
}
7070

7171
/**
72-
* @covers \Magento\BraintreeTwo\Gateway\Http\Client\TransactionSubmitForSettlement::placeRequest
72+
* @covers \Magento\BraintreeTwo\Gateway\Http\Client\TransactionSubmitForSettlement::process
7373
*/
7474
public function testPlaceRequest()
7575
{

app/code/Magento/BraintreeTwo/view/adminhtml/layout/braintreetwo_report_index.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
-->
88
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
99
<body>
10+
<referenceContainer name="page.main.actions">
11+
<block class="Magento\Backend\Block\Template" name="adminhtml.report.grid.braintreetwo.tooltip" template="Magento_BraintreeTwo::grid/tooltip.phtml">
12+
<arguments>
13+
<argument name="tooltip_content" xsi:type="string" translate="true">Apply filters in order to get results. Only first 100 records will be displayed in the grid, you will be able to download full version of the report in .csv format.</argument>
14+
</arguments>
15+
</block>
16+
</referenceContainer>
1017
<referenceContainer name="content">
1118
<uiComponent name="braintreetwo_report"/>
1219
</referenceContainer>

app/code/Magento/BraintreeTwo/view/adminhtml/templates/form/vault.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ $id = $block->escapeHtml($block->getData('id'));
2323
<img src="<?php echo $block->escapeUrl($icon['url']); ?>"
2424
width="<?php echo $block->escapeHtml($icon['width']); ?>"
2525
height="<?php echo $block->escapeHtml($icon['height']); ?>"
26-
>
26+
class="payment-icon" >
2727
<span><?php echo $block->escapeHtml(__('ending'));?></span>
2828
<span><?php echo $block->escapeHtml($details['maskedCC']); ?></span>
2929
(<span><?php echo $block->escapeHtml(__('expires'));?></span>:
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
/**
8+
* @var \Magento\Backend\Block\Template $block
9+
*/
10+
echo $block->escapeHtml($block->getData('tooltip_content'));

app/code/Magento/BraintreeTwo/view/frontend/web/js/view/payment/method-renderer/hosted-fields.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,12 @@ define([
112112
self.selectedCardType(null);
113113
}
114114

115-
if (!event.isValid) {
116-
return false;
117-
}
118-
119-
if (event.card) {
115+
if (event.target.fieldKey === 'number' && event.card) {
116+
if (event.isValid) {
117+
self.cardNumber = event.card;
118+
} else {
119+
self.cardNumber = null;
120+
}
120121
self.selectedCardType(
121122
validator.getMageCardType(event.card.type, self.getCcAvailableTypes())
122123
);

0 commit comments

Comments
 (0)