Skip to content

Commit 2dff306

Browse files
author
Paliarush, Alexander(apaliarush)
committed
Merge pull request #526 from magento-api/S55-Bug-Fixes
[API] Sprint 55 Bug Fixes
2 parents 1d40050 + e9063ea commit 2dff306

File tree

23 files changed

+94
-21
lines changed

23 files changed

+94
-21
lines changed

app/code/Magento/User/Model/User.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,9 @@ public function verifyIdentity($password)
470470
$result = false;
471471
if ($this->_encryptor->validateHash($password, $this->getPassword())) {
472472
if ($this->getIsActive() != '1') {
473-
throw new AuthenticationException(__('This account is inactive.'));
473+
throw new AuthenticationException(
474+
__('You did not sign in correctly or your account is temporarily disabled.')
475+
);
474476
}
475477
if (!$this->hasAssigned2Role($this->getId())) {
476478
throw new AuthenticationException(__('You need more permissions to access this.'));

app/code/Magento/User/Test/Unit/Model/UserTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ public function testVerifyIdentityInactiveRecord()
364364
$this->_model->setIsActive(false);
365365
$this->setExpectedException(
366366
'Magento\\Framework\\Exception\\AuthenticationException',
367-
'This account is inactive.'
367+
'You did not sign in correctly or your account is temporarily disabled.'
368368
);
369369
$this->_model->verifyIdentity($password);
370370
}

app/code/Magento/User/i18n/de_DE.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Permissions,Permissions
8585
"Your password must be at least %1 characters.","Your password must be at least %1 characters."
8686
"Your password must include both numeric and alphabetic characters.","Your password must include both numeric and alphabetic characters."
8787
"Your password confirmation must match your password.","Your password confirmation must match your password."
88-
"This account is inactive.","This account is inactive."
88+
"You did not sign in correctly or your account is temporarily disabled.","You did not sign in correctly or your account is temporarily disabled."
8989
"Forgot your user name or password?","Forgot your user name or password?"
9090
"Retrieve Password","Retrieve Password"
9191
"Forgot your password?","Forgot your password?"

app/code/Magento/User/i18n/en_US.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Permissions,Permissions
8585
"Your password must be at least %1 characters.","Your password must be at least %1 characters."
8686
"Your password must include both numeric and alphabetic characters.","Your password must include both numeric and alphabetic characters."
8787
"Your password confirmation must match your password.","Your password confirmation must match your password."
88-
"This account is inactive.","This account is inactive."
88+
"You did not sign in correctly or your account is temporarily disabled.","You did not sign in correctly or your account is temporarily disabled."
8989
"Forgot your user name or password?","Forgot your user name or password?"
9090
"Retrieve Password","Retrieve Password"
9191
"Forgot your password?","Forgot your password?"

app/code/Magento/User/i18n/es_ES.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Permissions,Permissions
8585
"Your password must be at least %1 characters.","Your password must be at least %1 characters."
8686
"Your password must include both numeric and alphabetic characters.","Your password must include both numeric and alphabetic characters."
8787
"Your password confirmation must match your password.","Your password confirmation must match your password."
88-
"This account is inactive.","This account is inactive."
88+
"You did not sign in correctly or your account is temporarily disabled.","You did not sign in correctly or your account is temporarily disabled."
8989
"Forgot your user name or password?","Forgot your user name or password?"
9090
"Retrieve Password","Retrieve Password"
9191
"Forgot your password?","Forgot your password?"

app/code/Magento/User/i18n/fr_FR.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Permissions,Permissions
8585
"Your password must be at least %1 characters.","Your password must be at least %1 characters."
8686
"Your password must include both numeric and alphabetic characters.","Your password must include both numeric and alphabetic characters."
8787
"Your password confirmation must match your password.","Your password confirmation must match your password."
88-
"This account is inactive.","This account is inactive."
88+
"You did not sign in correctly or your account is temporarily disabled.","You did not sign in correctly or your account is temporarily disabled."
8989
"Forgot your user name or password?","Forgot your user name or password?"
9090
"Retrieve Password","Retrieve Password"
9191
"Forgot your password?","Forgot your password?"

app/code/Magento/User/i18n/nl_NL.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Permissions,Permissions
8585
"Your password must be at least %1 characters.","Your password must be at least %1 characters."
8686
"Your password must include both numeric and alphabetic characters.","Your password must include both numeric and alphabetic characters."
8787
"Your password confirmation must match your password.","Your password confirmation must match your password."
88-
"This account is inactive.","This account is inactive."
88+
"You did not sign in correctly or your account is temporarily disabled.","You did not sign in correctly or your account is temporarily disabled."
8989
"Forgot your user name or password?","Forgot your user name or password?"
9090
"Retrieve Password","Retrieve Password"
9191
"Forgot your password?","Forgot your password?"

app/code/Magento/User/i18n/pt_BR.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Permissions,Permissions
8585
"Your password must be at least %1 characters.","Your password must be at least %1 characters."
8686
"Your password must include both numeric and alphabetic characters.","Your password must include both numeric and alphabetic characters."
8787
"Your password confirmation must match your password.","Your password confirmation must match your password."
88-
"This account is inactive.","This account is inactive."
88+
"You did not sign in correctly or your account is temporarily disabled.","You did not sign in correctly or your account is temporarily disabled."
8989
"Forgot your user name or password?","Forgot your user name or password?"
9090
"Retrieve Password","Retrieve Password"
9191
"Forgot your password?","Forgot your password?"

app/code/Magento/User/i18n/zh_CN.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Permissions,Permissions
8585
"Your password must be at least %1 characters.","Your password must be at least %1 characters."
8686
"Your password must include both numeric and alphabetic characters.","Your password must include both numeric and alphabetic characters."
8787
"Your password confirmation must match your password.","Your password confirmation must match your password."
88-
"This account is inactive.","This account is inactive."
88+
"You did not sign in correctly or your account is temporarily disabled.","You did not sign in correctly or your account is temporarily disabled."
8989
"Forgot your user name or password?","Forgot your user name or password?"
9090
"Retrieve Password","Retrieve Password"
9191
"Forgot your password?","Forgot your password?"

app/code/Magento/User/view/adminhtml/templates/admin/resetforgottenpassword.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
?>
1010

11-
<form method="post" data-mage-init='{"form": {}, "validation": {}}' action="<?php echo $block->getUrl('*/auth/resetpasswordpost', ['_query' => ['id' => $block->getUserId(), 'token' => $block->getResetPasswordLinkToken()]]); ?>" id="reset-password-form">
11+
<form method="post" data-mage-init='{"form": {}, "validation": {}}' action="<?php echo $block->getUrl('*/auth/resetpasswordpost', ['_query' => ['id' => $block->getUserId(), 'token' => $block->getResetPasswordLinkToken()]]); ?>" id="reset-password-form" autocomplete="off">
1212
<fieldset class="admin__fieldset">
1313
<legend class="admin__legend"><span><?php echo __('Reset a Password'); ?></span></legend><br />
1414
<input name="form_key" type="hidden" value="<?php echo $block->getFormKey(); ?>" />

app/code/Magento/Webapi/Test/Unit/Model/Authorization/OauthUserContextTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ protected function setUp()
7070

7171
$this->oauthRequestHelper = $this->getMockBuilder('Magento\Framework\Oauth\Helper\Request')
7272
->disableOriginalConstructor()
73-
->setMethods(['prepareRequest'])
73+
->setMethods(['prepareRequest', 'getRequestUrl'])
7474
->getMock();
7575

7676
$this->oauthService = $this->getMockBuilder('Magento\Framework\Oauth\Oauth')

dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/RequestTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ protected function setUp()
1818
{
1919
$this->_model = new \Magento\TestFramework\Request(
2020
$this->getMock('Magento\Framework\Stdlib\Cookie\CookieReaderInterface'),
21+
$this->getMock('Magento\Framework\Stdlib\StringUtils'),
2122
$this->getMock('Magento\Framework\App\Route\ConfigInterface\Proxy', [], [], '', false),
2223
$this->getMock('Magento\Framework\App\Request\PathInfoProcessorInterface'),
2324
$this->getMock('Magento\Framework\ObjectManagerInterface')

lib/internal/Magento/Framework/App/Request/Http.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22
/**
3-
* Http request
4-
*
53
* Copyright © 2015 Magento. All rights reserved.
64
* See COPYING.txt for license details.
75
*/
@@ -13,7 +11,11 @@
1311
use Magento\Framework\HTTP\PhpEnvironment\Request;
1412
use Magento\Framework\ObjectManagerInterface;
1513
use Magento\Framework\Stdlib\Cookie\CookieReaderInterface;
14+
use Magento\Framework\Stdlib\StringUtils;
1615

16+
/**
17+
* Http request
18+
*/
1719
class Http extends Request implements RequestInterface
1820
{
1921
/**#@+
@@ -79,6 +81,7 @@ class Http extends Request implements RequestInterface
7981

8082
/**
8183
* @param CookieReaderInterface $cookieReader
84+
* @param StringUtils $converter
8285
* @param ConfigInterface $routeConfig
8386
* @param PathInfoProcessorInterface $pathInfoProcessor
8487
* @param ObjectManagerInterface $objectManager
@@ -87,13 +90,14 @@ class Http extends Request implements RequestInterface
8790
*/
8891
public function __construct(
8992
CookieReaderInterface $cookieReader,
93+
StringUtils $converter,
9094
ConfigInterface $routeConfig,
9195
PathInfoProcessorInterface $pathInfoProcessor,
9296
ObjectManagerInterface $objectManager,
9397
$uri = null,
9498
$directFrontNames = []
9599
) {
96-
parent::__construct($cookieReader, $uri);
100+
parent::__construct($cookieReader, $converter, $uri);
97101
$this->routeConfig = $routeConfig;
98102
$this->pathInfoProcessor = $pathInfoProcessor;
99103
$this->objectManager = $objectManager;
@@ -302,6 +306,7 @@ public function isAjax()
302306
public function getDistroBaseUrl()
303307
{
304308
$headerHttpHost = $this->getServer('HTTP_HOST');
309+
$headerHttpHost = $this->converter->cleanString($headerHttpHost);
305310
$headerServerPort = $this->getServer('SERVER_PORT');
306311
$headerScriptName = $this->getServer('SCRIPT_NAME');
307312
$headerHttps = $this->getServer('HTTPS');

lib/internal/Magento/Framework/App/Test/Unit/HttpTest.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,30 @@ class HttpTest extends \PHPUnit_Framework_TestCase
6565
public function setUp()
6666
{
6767
$this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
68-
$this->requestMock = $this->getMockBuilder('Magento\Framework\App\Request\Http')
68+
$cookieReaderMock = $this->getMockBuilder('Magento\Framework\Stdlib\Cookie\CookieReaderInterface')
69+
->disableOriginalConstructor()
70+
->getMock();
71+
$routeConfigMock = $this->getMockBuilder('Magento\Framework\App\Route\ConfigInterface\Proxy')
6972
->disableOriginalConstructor()
73+
->getMock();
74+
$pathInfoProcessorMock = $this->getMockBuilder('Magento\Framework\App\Request\PathInfoProcessorInterface')
75+
->disableOriginalConstructor()
76+
->getMock();
77+
$converterMock = $this->getMockBuilder('Magento\Framework\Stdlib\StringUtils')
78+
->disableOriginalConstructor()
79+
->setMethods(['cleanString'])
80+
->getMock();
81+
$objectManagerMock = $this->getMockBuilder('Magento\Framework\ObjectManagerInterface')
82+
->disableOriginalConstructor()
83+
->getMock();
84+
$this->requestMock = $this->getMockBuilder('Magento\Framework\App\Request\Http')
85+
->setConstructorArgs([
86+
'cookieReader' => $cookieReaderMock,
87+
'converter' => $converterMock,
88+
'routeConfig' => $routeConfigMock,
89+
'pathInfoProcessor' => $pathInfoProcessorMock,
90+
'objectManager' => $objectManagerMock
91+
])
7092
->setMethods(['getFrontName'])
7193
->getMock();
7294
$this->areaListMock = $this->getMockBuilder('Magento\Framework\App\AreaList')

lib/internal/Magento/Framework/App/Test/Unit/Request/HttpTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ class HttpTest extends \PHPUnit_Framework_TestCase
3636
*/
3737
protected $objectManager;
3838

39+
/**
40+
* @var \Magento\Framework\Stdlib\StringUtils | \PHPUnit_Framework_MockObject_MockObject
41+
*/
42+
protected $converterMock;
43+
3944
/**
4045
* @var array
4146
*/
@@ -54,6 +59,11 @@ protected function setUp()
5459
$this->_infoProcessorMock = $this->getMock('Magento\Framework\App\Request\PathInfoProcessorInterface');
5560
$this->_infoProcessorMock->expects($this->any())->method('process')->will($this->returnArgument(1));
5661
$this->objectManager = $this->getMock('Magento\Framework\ObjectManagerInterface');
62+
$this->converterMock = $this->getMockBuilder('Magento\Framework\Stdlib\StringUtils')
63+
->disableOriginalConstructor()
64+
->setMethods(['cleanString'])
65+
->getMock();
66+
$this->converterMock->expects($this->any())->method('cleanString')->will($this->returnArgument(0));
5767

5868
// Stash the $_SERVER array to protect it from modification in test
5969
$this->serverArray = $_SERVER;
@@ -76,6 +86,7 @@ private function getModel($uri = null)
7686
'routeConfig' => $this->_routerListMock,
7787
'pathInfoProcessor' => $this->_infoProcessorMock,
7888
'objectManager' => $this->objectManager,
89+
'converter' => $this->converterMock,
7990
'uri' => $uri,
8091
]
8192
);

lib/internal/Magento/Framework/HTTP/PhpEnvironment/Request.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Magento\Framework\HTTP\PhpEnvironment;
77

88
use Magento\Framework\Stdlib\Cookie\CookieReaderInterface;
9+
use Magento\Framework\Stdlib\StringUtils;
910
use Zend\Http\Header\HeaderInterface;
1011
use Zend\Stdlib\Parameters;
1112
use Zend\Stdlib\ParametersInterface;
@@ -79,12 +80,19 @@ class Request extends \Zend\Http\PhpEnvironment\Request
7980
*/
8081
protected $cookieReader;
8182

83+
/**
84+
* @var StringUtils
85+
*/
86+
protected $converter;
87+
8288
/**
8389
* @param CookieReaderInterface $cookieReader
90+
* @param StringUtils $converter
8491
* @param UriInterface|string|null $uri
8592
*/
8693
public function __construct(
8794
CookieReaderInterface $cookieReader,
95+
StringUtils $converter,
8896
$uri = null
8997
) {
9098
$this->cookieReader = $cookieReader;
@@ -103,6 +111,7 @@ public function __construct(
103111
throw new \InvalidArgumentException('Invalid URI provided to constructor');
104112
}
105113
}
114+
$this->converter = $converter;
106115
parent::__construct();
107116
}
108117

@@ -608,6 +617,7 @@ public function getHeader($name, $default = false)
608617
public function getHttpHost($trimPort = true)
609618
{
610619
$httpHost = $this->getServer('HTTP_HOST');
620+
$httpHost = $this->converter->cleanString($httpHost);
611621
if (empty($httpHost)) {
612622
return false;
613623
}

lib/internal/Magento/Framework/HTTP/Test/Unit/PhpEnvironment/RequestTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ class RequestTest extends \PHPUnit_Framework_TestCase
2626
*/
2727
private $cookieReader;
2828

29+
/**
30+
* @var \Magento\Framework\Stdlib\StringUtils | \PHPUnit_Framework_MockObject_MockObject
31+
*/
32+
private $converter;
33+
2934
/**
3035
* @var array
3136
*/
@@ -35,6 +40,7 @@ protected function setUp()
3540
{
3641
$this->objectManager = $this->getMock('Magento\Framework\ObjectManagerInterface');
3742
$this->cookieReader = $this->getMock('Magento\Framework\Stdlib\Cookie\CookieReaderInterface');
43+
$this->converter = $this->getMock('Magento\Framework\Stdlib\StringUtils');
3844
// Stash the $_SERVER array to protect it from modification in test
3945
$this->serverArray = $_SERVER;
4046
}
@@ -46,7 +52,7 @@ public function tearDown()
4652

4753
private function getModel($uri = null)
4854
{
49-
return new Request($this->cookieReader, $uri);
55+
return new Request($this->cookieReader, $this->converter, $uri);
5056
}
5157

5258
public function testSetPathInfoWithNullValue()

lib/internal/Magento/Framework/Webapi/Request.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,27 @@
1212
use Magento\Framework\Config\ScopeInterface;
1313
use Magento\Framework\HTTP\PhpEnvironment\Request as HttpRequest;
1414
use Magento\Framework\Stdlib\Cookie\CookieReaderInterface;
15+
use Magento\Framework\Stdlib\StringUtils;
1516

1617
class Request extends HttpRequest implements RequestInterface
1718
{
1819
/**
1920
* Modify pathInfo: strip down the front name and query parameters.
2021
*
22+
* @param CookieReaderInterface $cookieReader
23+
* @param StringUtils $converter
2124
* @param AreaList $areaList
2225
* @param ScopeInterface $configScope
23-
* @param CookieReaderInterface $cookieReader
2426
* @param null|string|\Zend_Uri $uri
2527
*/
2628
public function __construct(
2729
CookieReaderInterface $cookieReader,
30+
StringUtils $converter,
2831
AreaList $areaList,
2932
ScopeInterface $configScope,
3033
$uri = null
3134
) {
32-
parent::__construct($cookieReader, $uri);
35+
parent::__construct($cookieReader, $converter, $uri);
3336

3437
$pathInfo = $this->getRequestUri();
3538
/** Remove base url and area from path */

lib/internal/Magento/Framework/Webapi/Rest/Request.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,21 @@ class Request extends \Magento\Framework\Webapi\Request
4848
* Initialize dependencies
4949
*
5050
* @param \Magento\Framework\Stdlib\Cookie\CookieReaderInterface $cookieReader
51+
* @param \Magento\Framework\Stdlib\StringUtils $converter
5152
* @param \Magento\Framework\App\AreaList $areaList
5253
* @param \Magento\Framework\Config\ScopeInterface $configScope
5354
* @param \Magento\Framework\Webapi\Rest\Request\DeserializerFactory $deserializerFactory
5455
* @param null|string $uri
5556
*/
5657
public function __construct(
5758
\Magento\Framework\Stdlib\Cookie\CookieReaderInterface $cookieReader,
59+
\Magento\Framework\Stdlib\StringUtils $converter,
5860
\Magento\Framework\App\AreaList $areaList,
5961
\Magento\Framework\Config\ScopeInterface $configScope,
6062
\Magento\Framework\Webapi\Rest\Request\DeserializerFactory $deserializerFactory,
6163
$uri = null
6264
) {
63-
parent::__construct($cookieReader, $areaList, $configScope, $uri);
65+
parent::__construct($cookieReader, $converter, $areaList, $configScope, $uri);
6466
$this->_deserializerFactory = $deserializerFactory;
6567
}
6668

lib/internal/Magento/Framework/Webapi/Test/Unit/Rest/RequestTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,14 @@ protected function setUp()
3838
/** Instantiate request. */
3939
// TODO: Get rid of SUT mocks.
4040
$this->_cookieManagerMock = $this->getMock('Magento\Framework\Stdlib\CookieManagerInterface');
41+
$converterMock = $this->getMockBuilder('Magento\Framework\Stdlib\StringUtils')
42+
->disableOriginalConstructor()
43+
->setMethods(['cleanString'])
44+
->getMock();
4145
$this->_request = $this->getMock(
4246
'Magento\Framework\Webapi\Rest\Request',
4347
['getHeader', 'getMethod', 'isGet', 'isPost', 'isPut', 'isDelete', 'getContent'],
44-
[$this->_cookieManagerMock, $areaListMock, $configScopeMock, $this->_deserializerFactory, ]
48+
[$this->_cookieManagerMock, $converterMock, $areaListMock, $configScopeMock, $this->_deserializerFactory]
4549
);
4650

4751
parent::setUp();

pub/get.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@
2727
return $isResourceAllowed;
2828
};
2929

30-
$request = new \Magento\MediaStorage\Model\File\Storage\Request(new Request(new PhpCookieReader()));
30+
$request = new \Magento\MediaStorage\Model\File\Storage\Request(
31+
new Request(
32+
new PhpCookieReader(),
33+
new Magento\Framework\Stdlib\StringUtils()
34+
)
35+
);
3136
$relativePath = $request->getPathInfo();
3237
if (file_exists($configCacheFile) && is_readable($configCacheFile)) {
3338
$config = json_decode(file_get_contents($configCacheFile), true);

setup/view/magento/setup/add-database.phtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
novalidate
5252
name="database"
5353
role="form"
54+
autocomplete="off"
5455
>
5556

5657
<?php

setup/view/magento/setup/create-admin-account.phtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ $passwordWizard = sprintf(
4949
novalidate
5050
name="account"
5151
role="form"
52+
autocomplete="off"
5253
>
5354

5455
<div

0 commit comments

Comments
 (0)