Skip to content

Commit 1c8f4b9

Browse files
committed
Merge remote-tracking branch 'origin/ACP2E-320' into L3_Arrows_PR_20220221
2 parents e72a1bd + 4881b02 commit 1c8f4b9

File tree

5 files changed

+35
-8
lines changed

5 files changed

+35
-8
lines changed

app/code/Magento/Customer/Block/Account/AuthenticationPopup.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ public function __construct(
4242
}
4343

4444
/**
45+
* Returns serialize jsLayout
46+
*
4547
* @return string
4648
*/
4749
public function getJsLayout()
@@ -60,7 +62,8 @@ public function getConfig()
6062
'autocomplete' => $this->escapeHtml($this->isAutocompleteEnabled()),
6163
'customerRegisterUrl' => $this->escapeUrl($this->getCustomerRegisterUrlUrl()),
6264
'customerForgotPasswordUrl' => $this->escapeUrl($this->getCustomerForgotPasswordUrl()),
63-
'baseUrl' => $this->escapeUrl($this->getBaseUrl())
65+
'baseUrl' => $this->escapeUrl($this->getBaseUrl()),
66+
'customerLoginUrl' => $this->getUrl('customer/ajax/login'),
6467
];
6568
}
6669

app/code/Magento/Customer/Test/Unit/Block/Account/AuthenticationPopupTest.php

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ function ($string) {
102102
*
103103
* @dataProvider dataProviderGetConfig
104104
*/
105-
public function testGetConfig($isAutocomplete, $baseUrl, $registerUrl, $forgotUrl, array $result)
105+
public function testGetConfig($isAutocomplete, $baseUrl, $registerUrl, $forgotUrl, $loginUrl, array $result)
106106
{
107107
$this->scopeConfigMock->expects($this->any())
108108
->method('getValue')
@@ -129,6 +129,7 @@ public function testGetConfig($isAutocomplete, $baseUrl, $registerUrl, $forgotUr
129129
[
130130
['customer/account/create', [], $registerUrl],
131131
['customer/account/forgotpassword', [], $forgotUrl],
132+
['customer/ajax/login', [], $loginUrl],
132133
]
133134
);
134135

@@ -146,47 +147,55 @@ public function dataProviderGetConfig()
146147
'base',
147148
'reg',
148149
'forgot',
150+
'loginUrl',
149151
[
150152
'autocomplete' => 'escapeHtmloff',
151153
'customerRegisterUrl' => 'escapeUrlreg',
152154
'customerForgotPasswordUrl' => 'escapeUrlforgot',
153155
'baseUrl' => 'escapeUrlbase',
156+
'customerLoginUrl'=>'loginUrl',
154157
],
155158
],
156159
[
157160
1,
158161
'',
159162
'reg',
160163
'forgot',
164+
'loginUrl',
161165
[
162166
'autocomplete' => 'escapeHtmlon',
163167
'customerRegisterUrl' => 'escapeUrlreg',
164168
'customerForgotPasswordUrl' => 'escapeUrlforgot',
165169
'baseUrl' => 'escapeUrl',
170+
'customerLoginUrl'=>'loginUrl',
166171
],
167172
],
168173
[
169174
'',
170175
'base',
171176
'',
172177
'forgot',
178+
'loginUrl',
173179
[
174180
'autocomplete' => 'escapeHtmloff',
175181
'customerRegisterUrl' => 'escapeUrl',
176182
'customerForgotPasswordUrl' => 'escapeUrlforgot',
177183
'baseUrl' => 'escapeUrlbase',
184+
'customerLoginUrl'=>'loginUrl',
178185
],
179186
],
180187
[
181188
true,
182189
'base',
183190
'reg',
184191
'',
192+
'loginUrl',
185193
[
186194
'autocomplete' => 'escapeHtmlon',
187195
'customerRegisterUrl' => 'escapeUrlreg',
188196
'customerForgotPasswordUrl' => 'escapeUrl',
189197
'baseUrl' => 'escapeUrlbase',
198+
'customerLoginUrl'=>'loginUrl',
190199
],
191200
],
192201
];
@@ -202,8 +211,14 @@ public function dataProviderGetConfig()
202211
*
203212
* @dataProvider dataProviderGetConfig
204213
*/
205-
public function testGetSerializedConfig($isAutocomplete, $baseUrl, $registerUrl, $forgotUrl, array $result)
206-
{
214+
public function testGetSerializedConfig(
215+
$isAutocomplete,
216+
$baseUrl,
217+
$registerUrl,
218+
$forgotUrl,
219+
$loginUrl,
220+
array $result
221+
) {
207222
$this->scopeConfigMock->expects($this->any())
208223
->method('getValue')
209224
->with(Form::XML_PATH_ENABLE_AUTOCOMPLETE, ScopeInterface::SCOPE_STORE, null)
@@ -229,6 +244,7 @@ public function testGetSerializedConfig($isAutocomplete, $baseUrl, $registerUrl,
229244
[
230245
['customer/account/create', [], $registerUrl],
231246
['customer/account/forgotpassword', [], $forgotUrl],
247+
['customer/ajax/login', [], $loginUrl],
232248
]
233249
);
234250
$this->serializerMock->expects($this->any())->method('serialize')

app/code/Magento/Customer/view/frontend/web/js/action/login.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,15 @@ define([
2222
*/
2323
action = function (loginData, redirectUrl, isGlobal, messageContainer) {
2424
messageContainer = messageContainer || globalMessageList;
25+
let customerLoginUrl = 'customer/ajax/login';
26+
27+
if (loginData.customerLoginUrl) {
28+
customerLoginUrl = loginData.customerLoginUrl;
29+
delete loginData.customerLoginUrl;
30+
}
2531

2632
return storage.post(
27-
'customer/ajax/login',
33+
customerLoginUrl,
2834
JSON.stringify(loginData),
2935
isGlobal
3036
).done(function (response) {

app/code/Magento/Customer/view/frontend/web/js/view/authentication-popup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ define([
8080
formDataArray.forEach(function (entry) {
8181
loginData[entry.name] = entry.value;
8282
});
83-
83+
loginData['customerLoginUrl'] = window.authenticationPopup.customerLoginUrl;
8484
if (formElement.validation() &&
8585
formElement.validation('isValid')
8686
) {

dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/view/authentication-popup.test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ define(['squire'], function (Squire) {
3030
customerRegisterUrl: 'register_url',
3131
customerForgotPasswordUrl: 'forgot_password_url',
3232
autocomplete: 'autocomplete_flag',
33-
baseUrl: 'base_url'
33+
baseUrl: 'base_url',
34+
customerLoginUrl:'customer_login_url'
3435
};
3536

3637
injector.mock(mocks);
@@ -81,7 +82,8 @@ define(['squire'], function (Squire) {
8182

8283
expect(obj.login(null, event)).toBeFalsy();
8384
expect(mocks['Magento_Customer/js/action/login']).toHaveBeenCalledWith({
84-
username: 'customer'
85+
username: 'customer',
86+
customerLoginUrl: 'customer_login_url'
8587
});
8688
});
8789
});

0 commit comments

Comments
 (0)