Skip to content

Commit 5ee35e5

Browse files
🔃 [Magento Community Engineering] Community Contributions - 2.3-develop expedited
Accepted Community Pull Requests: - #24340: magento/magento2#: Captcha. Improvement. Replace deprecated addError with addErrorMessage. (by @atwixfirster) - #24333: #23966: WYSIWYG image upload dialog hangs up. (by @p-bystritsky) - #24183: Resolve model Rss extends wrong class (by @edenduong) - #24506: Fixes excluding js files from bundles when minifying is enabled (by @hostep) Fixed GitHub Issues: - #23966: WYSIWYG image upload dialog hangs up (reported by @sshymko) has been fixed in #24333 by @p-bystritsky in 2.3-develop branch Related commits: 1. 3acfc94 2. 48b48dd - #4506: Javascript Bundling produces huge 13MB js files (reported by @VegasJames) has been fixed in #24506 by @hostep in 2.3-develop branch Related commits: 1. 41ef34f 2. cbe25f4 - #13558: In Magento 2.2.2, Javascript bundling file size is big while comparing with Magento 2.1.10 (reported by @karangar) has been fixed in #24506 by @hostep in 2.3-develop branch Related commits: 1. 41ef34f 2. cbe25f4 - #14357: zxcvbn.js included in merged.js (reported by @cannycookie) has been fixed in #24506 by @hostep in 2.3-develop branch Related commits: 1. 41ef34f 2. cbe25f4
2 parents f092e4a + 9993a56 commit 5ee35e5

27 files changed

+177
-90
lines changed

app/code/Magento/Captcha/Observer/CheckContactUsFormObserver.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
use Magento\Framework\App\Request\DataPersistorInterface;
1010
use Magento\Framework\App\ObjectManager;
1111

12+
/**
13+
* Class CheckContactUsFormObserver
14+
*/
1215
class CheckContactUsFormObserver implements ObserverInterface
1316
{
1417
/**
@@ -76,7 +79,7 @@ public function execute(\Magento\Framework\Event\Observer $observer)
7679
/** @var \Magento\Framework\App\Action\Action $controller */
7780
$controller = $observer->getControllerAction();
7881
if (!$captcha->isCorrect($this->captchaStringResolver->resolve($controller->getRequest(), $formId))) {
79-
$this->messageManager->addError(__('Incorrect CAPTCHA.'));
82+
$this->messageManager->addErrorMessage(__('Incorrect CAPTCHA.'));
8083
$this->getDataPersistor()->set($formId, $controller->getRequest()->getPostValue());
8184
$this->_actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);
8285
$this->redirect->redirect($controller->getResponse(), 'contact/index/index');

app/code/Magento/Captcha/Observer/CheckForgotpasswordObserver.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
use Magento\Framework\Event\ObserverInterface;
99

10+
/**
11+
* Class CheckForgotpasswordObserver
12+
*/
1013
class CheckForgotpasswordObserver implements ObserverInterface
1114
{
1215
/**
@@ -69,7 +72,7 @@ public function execute(\Magento\Framework\Event\Observer $observer)
6972
/** @var \Magento\Framework\App\Action\Action $controller */
7073
$controller = $observer->getControllerAction();
7174
if (!$captchaModel->isCorrect($this->captchaStringResolver->resolve($controller->getRequest(), $formId))) {
72-
$this->messageManager->addError(__('Incorrect CAPTCHA'));
75+
$this->messageManager->addErrorMessage(__('Incorrect CAPTCHA'));
7376
$this->_actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);
7477
$this->redirect->redirect($controller->getResponse(), '*/*/forgotpassword');
7578
}

app/code/Magento/Captcha/Observer/CheckUserCreateObserver.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77

88
use Magento\Framework\Event\ObserverInterface;
99

10+
/**
11+
* Class CheckUserCreateObserver
12+
*
13+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
14+
*/
1015
class CheckUserCreateObserver implements ObserverInterface
1116
{
1217
/**
@@ -86,7 +91,7 @@ public function execute(\Magento\Framework\Event\Observer $observer)
8691
/** @var \Magento\Framework\App\Action\Action $controller */
8792
$controller = $observer->getControllerAction();
8893
if (!$captchaModel->isCorrect($this->captchaStringResolver->resolve($controller->getRequest(), $formId))) {
89-
$this->messageManager->addError(__('Incorrect CAPTCHA'));
94+
$this->messageManager->addErrorMessage(__('Incorrect CAPTCHA'));
9095
$this->_actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);
9196
$this->_session->setCustomerFormData($controller->getRequest()->getPostValue());
9297
$url = $this->_urlManager->getUrl('*/*/create', ['_nosecret' => true]);

app/code/Magento/Captcha/Observer/CheckUserEditObserver.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@
1111
use Magento\Framework\App\Config\ScopeConfigInterface;
1212

1313
/**
14-
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
14+
* Class CheckUserEditObserver
15+
*
16+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
1517
*/
1618
class CheckUserEditObserver implements ObserverInterface
1719
{
18-
/**
19-
* Form ID
20-
*/
2120
const FORM_ID = 'user_edit';
2221

2322
/**
@@ -96,7 +95,8 @@ public function __construct(
9695
* Check Captcha On Forgot Password Page
9796
*
9897
* @param \Magento\Framework\Event\Observer $observer
99-
* @return $this
98+
* @return $this|void
99+
* @throws \Magento\Framework\Exception\SessionException
100100
*/
101101
public function execute(\Magento\Framework\Event\Observer $observer)
102102
{
@@ -119,9 +119,9 @@ public function execute(\Magento\Framework\Event\Observer $observer)
119119
'The account is locked. Please wait and try again or contact %1.',
120120
$this->scopeConfig->getValue('contact/email/recipient_email')
121121
);
122-
$this->messageManager->addError($message);
122+
$this->messageManager->addErrorMessage($message);
123123
}
124-
$this->messageManager->addError(__('Incorrect CAPTCHA'));
124+
$this->messageManager->addErrorMessage(__('Incorrect CAPTCHA'));
125125
$this->actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);
126126
$this->redirect->redirect($controller->getResponse(), '*/*/edit');
127127
}

app/code/Magento/Captcha/Observer/CheckUserForgotPasswordBackendObserver.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77

88
use Magento\Framework\Event\ObserverInterface;
99

10+
/**
11+
* Class CheckUserForgotPasswordBackendObserver
12+
*
13+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
14+
*/
1015
class CheckUserForgotPasswordBackendObserver implements ObserverInterface
1116
{
1217
/**
@@ -76,7 +81,7 @@ public function execute(\Magento\Framework\Event\Observer $observer)
7681
) {
7782
$this->_session->setEmail((string)$controller->getRequest()->getPost('email'));
7883
$this->_actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);
79-
$this->messageManager->addError(__('Incorrect CAPTCHA'));
84+
$this->messageManager->addErrorMessage(__('Incorrect CAPTCHA'));
8085
$controller->getResponse()->setRedirect(
8186
$controller->getUrl('*/*/forgotpassword', ['_nosecret' => true])
8287
);

app/code/Magento/Captcha/Observer/CheckUserLoginObserver.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
namespace Magento\Captcha\Observer;
88

9+
use Magento\Customer\Api\CustomerRepositoryInterface;
910
use Magento\Customer\Model\AuthenticationInterface;
1011
use Magento\Framework\Event\ObserverInterface;
1112
use Magento\Framework\Exception\NoSuchEntityException;
12-
use Magento\Customer\Api\CustomerRepositoryInterface;
1313

1414
/**
1515
* Check captcha on user login page observer.
@@ -64,6 +64,8 @@ class CheckUserLoginObserver implements ObserverInterface
6464
protected $authentication;
6565

6666
/**
67+
* CheckUserLoginObserver constructor.
68+
*
6769
* @param \Magento\Captcha\Helper\Data $helper
6870
* @param \Magento\Framework\App\ActionFlag $actionFlag
6971
* @param \Magento\Framework\Message\ManagerInterface $messageManager
@@ -125,8 +127,7 @@ private function getAuthentication()
125127
* Check captcha on user login page
126128
*
127129
* @param \Magento\Framework\Event\Observer $observer
128-
* @throws NoSuchEntityException
129-
* @return $this
130+
* @return $this|void
130131
*/
131132
public function execute(\Magento\Framework\Event\Observer $observer)
132133
{
@@ -143,10 +144,11 @@ public function execute(\Magento\Framework\Event\Observer $observer)
143144
try {
144145
$customer = $this->getCustomerRepository()->get($login);
145146
$this->getAuthentication()->processAuthenticationFailure($customer->getId());
147+
// phpcs:ignore Magento2.CodeAnalysis.EmptyBlock
146148
} catch (NoSuchEntityException $e) {
147149
//do nothing as customer existence is validated later in authenticate method
148150
}
149-
$this->messageManager->addError(__('Incorrect CAPTCHA'));
151+
$this->messageManager->addErrorMessage(__('Incorrect CAPTCHA'));
150152
$this->_actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);
151153
$this->_session->setUsername($login);
152154
$beforeUrl = $this->_session->getBeforeAuthUrl();

app/code/Magento/Captcha/Test/Unit/Observer/CheckContactUsFormObserverTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ protected function setUp()
6969
$this->messageManagerMock = $this->createMock(\Magento\Framework\Message\ManagerInterface::class);
7070
$this->redirectMock = $this->createMock(\Magento\Framework\App\Response\RedirectInterface::class);
7171
$this->captchaStringResolverMock = $this->createMock(\Magento\Captcha\Observer\CaptchaStringResolver::class);
72-
$this->sessionMock = $this->createPartialMock(\Magento\Framework\Session\SessionManager::class, ['addError']);
72+
$this->sessionMock = $this->createPartialMock(
73+
\Magento\Framework\Session\SessionManager::class,
74+
['addErrorMessage']
75+
);
7376
$this->dataPersistorMock = $this->getMockBuilder(\Magento\Framework\App\Request\DataPersistorInterface::class)
7477
->getMockForAbstractClass();
7578

@@ -116,7 +119,7 @@ public function testCheckContactUsFormWhenCaptchaIsRequiredAndValid()
116119
$this->helperMock->expects($this->any())
117120
->method('getCaptcha')
118121
->with($formId)->willReturn($this->captchaMock);
119-
$this->sessionMock->expects($this->never())->method('addError');
122+
$this->sessionMock->expects($this->never())->method('addErrorMessage');
120123

121124
$this->checkContactUsFormObserver->execute(
122125
new \Magento\Framework\Event\Observer(['controller_action' => $controller])
@@ -163,7 +166,7 @@ public function testCheckContactUsFormRedirectsCustomerWithWarningMessageWhenCap
163166
->method('getCaptcha')
164167
->with($formId)
165168
->willReturn($this->captchaMock);
166-
$this->messageManagerMock->expects($this->once())->method('addError')->with($warningMessage);
169+
$this->messageManagerMock->expects($this->once())->method('addErrorMessage')->with($warningMessage);
167170
$this->actionFlagMock->expects($this->once())
168171
->method('set')
169172
->with('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);

app/code/Magento/Captcha/Test/Unit/Observer/CheckForgotpasswordObserverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public function testCheckForgotpasswordRedirects()
138138
)->will(
139139
$this->returnValue($this->_captcha)
140140
);
141-
$this->_messageManager->expects($this->once())->method('addError')->with($warningMessage);
141+
$this->_messageManager->expects($this->once())->method('addErrorMessage')->with($warningMessage);
142142
$this->_actionFlag->expects(
143143
$this->once()
144144
)->method(

app/code/Magento/Captcha/Test/Unit/Observer/CheckUserCreateObserverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public function testCheckUserCreateRedirectsError()
151151
)->will(
152152
$this->returnValue($this->_captcha)
153153
);
154-
$this->_messageManager->expects($this->once())->method('addError')->with($warningMessage);
154+
$this->_messageManager->expects($this->once())->method('addErrorMessage')->with($warningMessage);
155155
$this->_actionFlag->expects(
156156
$this->once()
157157
)->method(

app/code/Magento/Captcha/Test/Unit/Observer/CheckUserEditObserverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public function testExecute()
146146

147147
$message = __('The account is locked. Please wait and try again or contact %1.', $email);
148148
$this->messageManagerMock->expects($this->exactly(2))
149-
->method('addError')
149+
->method('addErrorMessage')
150150
->withConsecutive([$message], [__('Incorrect CAPTCHA')]);
151151

152152
$this->actionFlagMock->expects($this->once())

app/code/Magento/Captcha/Test/Unit/Observer/CheckUserLoginObserverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public function testExecute()
145145
->with($customerId);
146146

147147
$this->messageManagerMock->expects($this->once())
148-
->method('addError')
148+
->method('addErrorMessage')
149149
->with(__('Incorrect CAPTCHA'));
150150

151151
$this->actionFlagMock->expects($this->once())

app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
<description value="Admin should be able to add image to WYSIWYG Editor on Product Page"/>
1717
<severity value="CRITICAL"/>
1818
<testCaseId value="MAGETWO-84375"/>
19-
<skip>
20-
<issueId value="MC-17232"/>
21-
</skip>
2219
</annotations>
2320
<before>
2421
<actionGroup ref="LoginActionGroup" stepKey="login"/>
@@ -78,6 +75,8 @@
7875
<waitForLoadingMaskToDisappear stepKey="waitForLoading13"/>
7976
<see selector="{{ProductShortDescriptionWYSIWYGToolbarSection.CreateFolder}}" userInput="Create Folder" stepKey="seeCreateFolderBtn2" />
8077
<waitForLoadingMaskToDisappear stepKey="waitForLoading14"/>
78+
<click userInput="Storage Root" stepKey="clickOnRootFolder" />
79+
<waitForLoadingMaskToDisappear stepKey="waitForLoading15"/>
8180
<dontSeeElement selector="{{ProductShortDescriptionWYSIWYGToolbarSection.InsertFile}}" stepKey="dontSeeAddSelectedBtn3" />
8281
<attachFile selector="{{ProductShortDescriptionWYSIWYGToolbarSection.BrowseUploadImage}}" userInput="{{ImageUpload3.value}}" stepKey="uploadImage3"/>
8382
<waitForLoadingMaskToDisappear stepKey="waitForFileUpload3"/>

app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGBlockTest.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
<description value="Admin should be able to add image to WYSIWYG content of Block"/>
1717
<severity value="CRITICAL"/>
1818
<testCaseId value="MAGETWO-84376"/>
19-
<skip>
20-
<issueId value="MC-17232"/>
21-
</skip>
2219
</annotations>
2320
<before>
2421
<createData entity="_defaultCmsPage" stepKey="createCMSPage" />

app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGCMSTest.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
<description value="Admin should be able to add image to WYSIWYG content of CMS Page"/>
1717
<severity value="CRITICAL"/>
1818
<testCaseId value="MAGETWO-85825"/>
19-
<skip>
20-
<issueId value="MC-17232"/>
21-
</skip>
2219
</annotations>
2320
<before>
2421
<createData entity="_defaultCmsPage" stepKey="createCMSPage" />

app/code/Magento/Customer/Controller/Account/Confirmation.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
11
<?php
22
/**
3-
*
43
* Copyright © Magento, Inc. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
76
namespace Magento\Customer\Controller\Account;
87

8+
use Magento\Customer\Api\AccountManagementInterface;
9+
use Magento\Customer\Controller\AbstractAccount;
10+
use Magento\Customer\Model\Session;
911
use Magento\Customer\Model\Url;
12+
use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface;
13+
use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface;
1014
use Magento\Framework\App\Action\Context;
11-
use Magento\Customer\Model\Session;
1215
use Magento\Framework\App\ObjectManager;
16+
use Magento\Framework\Exception\State\InvalidTransitionException;
1317
use Magento\Framework\View\Result\PageFactory;
1418
use Magento\Store\Model\StoreManagerInterface;
15-
use Magento\Customer\Api\AccountManagementInterface;
16-
use Magento\Framework\Exception\State\InvalidTransitionException;
1719

18-
class Confirmation extends \Magento\Customer\Controller\AbstractAccount
20+
/**
21+
* Class Confirmation. Send confirmation link to specified email
22+
*/
23+
class Confirmation extends AbstractAccount implements HttpGetActionInterface, HttpPostActionInterface
1924
{
2025
/**
2126
* @var \Magento\Store\Model\StoreManagerInterface
@@ -91,11 +96,11 @@ public function execute()
9196
$email,
9297
$this->storeManager->getStore()->getWebsiteId()
9398
);
94-
$this->messageManager->addSuccess(__('Please check your email for confirmation key.'));
99+
$this->messageManager->addSuccessMessage(__('Please check your email for confirmation key.'));
95100
} catch (InvalidTransitionException $e) {
96-
$this->messageManager->addSuccess(__('This email does not require confirmation.'));
101+
$this->messageManager->addSuccessMessage(__('This email does not require confirmation.'));
97102
} catch (\Exception $e) {
98-
$this->messageManager->addException($e, __('Wrong email.'));
103+
$this->messageManager->addExceptionMessage($e, __('Wrong email.'));
99104
$resultRedirect->setPath('*/*/*', ['email' => $email, '_secure' => true]);
100105
return $resultRedirect;
101106
}

0 commit comments

Comments
 (0)