File tree Expand file tree Collapse file tree 4 files changed +69
-3
lines changed
app/code/Magento/Customer/Model
dev/tests/integration/testsuite/Magento/Customer
lib/internal/Magento/Framework/Encryption Expand file tree Collapse file tree 4 files changed +69
-3
lines changed Original file line number Diff line number Diff line change @@ -161,12 +161,12 @@ public function isLocked($customerId)
161
161
}
162
162
163
163
/**
164
- * { @inheritdoc}
164
+ * @inheritdoc
165
165
*/
166
166
public function authenticate ($ customerId , $ password )
167
167
{
168
168
$ customerSecure = $ this ->customerRegistry ->retrieveSecureData ($ customerId );
169
- $ hash = $ customerSecure ->getPasswordHash ();
169
+ $ hash = $ customerSecure ->getPasswordHash () ?? '' ;
170
170
if (!$ this ->encryptor ->validateHash ($ password , $ hash )) {
171
171
$ this ->processAuthenticationFailure ($ customerId );
172
172
if ($ this ->isLocked ($ customerId )) {
Original file line number Diff line number Diff line change @@ -56,6 +56,35 @@ public function testIndexAction()
56
56
$ this ->assertContains ('Green str, 67 ' , $ body );
57
57
}
58
58
59
+ /**
60
+ * @magentoDataFixture Magento/Customer/_files/customer_no_password.php
61
+ */
62
+ public function testLoginWithIncorrectPassword ()
63
+ {
64
+ $ expectedMessage = 'The account sign-in was incorrect or your account is disabled temporarily. '
65
+ . 'Please wait and try again later. ' ;
66
+ $ this ->getRequest ()
67
+ ->setMethod ('POST ' )
68
+ ->setPostValue (
69
+ [
70
+ 'login ' => [
71
+ 'username ' => 'customer@example.com ' ,
72
+ 'password ' => '123123q '
73
+ ]
74
+ ]
75
+ );
76
+
77
+ $ this ->dispatch ('customer/account/loginPost ' );
78
+ $ this ->assertRedirect ($ this ->stringContains ('customer/account/login ' ));
79
+ $ this ->assertSessionMessages (
80
+ $ this ->equalTo (
81
+ [
82
+ $ expectedMessage
83
+ ]
84
+ )
85
+ );
86
+ }
87
+
59
88
/**
60
89
* Test sign up form displaying.
61
90
*/
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+ use Magento \Customer \Model \CustomerRegistry ;
7
+
8
+ $ objectManager = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ();
9
+ /** @var $repository \Magento\Customer\Api\CustomerRepositoryInterface */
10
+ $ repository = $ objectManager ->create (\Magento \Customer \Api \CustomerRepositoryInterface::class);
11
+ $ customer = $ objectManager ->create (\Magento \Customer \Model \Customer::class);
12
+ /** @var CustomerRegistry $customerRegistry */
13
+ $ customerRegistry = $ objectManager ->get (CustomerRegistry::class);
14
+ /** @var Magento\Customer\Model\Customer $customer */
15
+ $ customer ->setWebsiteId (1 )
16
+ ->setId (1 )
17
+ ->setEmail ('customer@example.com ' )
18
+ ->setGroupId (1 )
19
+ ->setStoreId (1 )
20
+ ->setIsActive (1 )
21
+ ->setPrefix ('Mr. ' )
22
+ ->setFirstname ('John ' )
23
+ ->setMiddlename ('A ' )
24
+ ->setLastname ('Smith ' )
25
+ ->setSuffix ('Esq. ' )
26
+ ->setDefaultBilling (1 )
27
+ ->setDefaultShipping (1 )
28
+ ->setTaxvat ('12 ' )
29
+ ->setGender (0 );
30
+
31
+ $ customer ->isObjectNew (true );
32
+ $ customer ->save ();
33
+ $ customerRegistry ->remove ($ customer ->getId ());
Original file line number Diff line number Diff line change @@ -263,7 +263,11 @@ private function getPasswordSalt()
263
263
*/
264
264
private function getPasswordVersion ()
265
265
{
266
- return array_map ('intval ' , explode (self ::DELIMITER , $ this ->passwordHashMap [self ::PASSWORD_VERSION ]));
266
+ return array_map ('intval ' , explode (
267
+ self ::DELIMITER ,
268
+ (string )$ this ->passwordHashMap [self ::PASSWORD_VERSION ]
269
+ )
270
+ );
267
271
}
268
272
269
273
/**
You can’t perform that action at this time.
0 commit comments