Skip to content

Commit ef12b17

Browse files
author
Stanislav Idolov
committed
MAGETWO-53049: Unexpected login popup after clicking "Go to Checkout" button
1 parent 296a561 commit ef12b17

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

app/code/Magento/Checkout/view/frontend/web/js/proceed-to-checkout.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ define([
1818

1919
event.preventDefault();
2020

21-
if (!customer().firstname && !cart().isGuestCheckoutAllowed) {
21+
if (!customer().firstname && cart().isGuestCheckoutAllowed === false) {
2222
authenticationPopup.showModal();
2323

2424
return false;

app/code/Magento/Checkout/view/frontend/web/js/sidebar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ define([
5454
var cart = customerData.get('cart'),
5555
customer = customerData.get('customer');
5656

57-
if (!customer().firstname && !cart().isGuestCheckoutAllowed) {
57+
if (!customer().firstname && cart().isGuestCheckoutAllowed === false) {
5858
// set URL for redirect on successful login/registration. It's postprocessed on backend.
5959
$.cookie('login_redirect', this.options.url.checkout);
6060
if (this.options.url.isRedirectRequired) {

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ define(
1111
],
1212
function ($, modal) {
1313
'use strict';
14+
1415
return {
1516
modalWindow: null,
1617

1718
/** Create popUp window for provided element */
18-
createPopUp: function(element) {
19+
createPopUp: function (element) {
1920
this.modalWindow = element;
2021
var options = {
2122
'type': 'popup',
@@ -29,7 +30,7 @@ define(
2930
},
3031

3132
/** Show login popup window */
32-
showModal: function() {
33+
showModal: function () {
3334
$(this.modalWindow).modal('openModal');
3435
}
3536
}

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

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ define(
1717
'Magento_Ui/js/modal/alert',
1818
'mage/validation'
1919
],
20-
function($, ko, Component, loginAction, customerData, authenticationPopup, $t, url, alert) {
20+
function ($, ko, Component, loginAction, customerData, authenticationPopup, $t, url, alert) {
2121
'use strict';
22+
2223
return Component.extend({
2324
registerUrl: window.authenticationPopup.customerRegisterUrl,
2425
forgotPasswordUrl: window.authenticationPopup.customerForgotPasswordUrl,
@@ -30,11 +31,14 @@ define(
3031
template: 'Magento_Customer/authentication-popup'
3132
},
3233

33-
initialize: function() {
34+
/**
35+
* Init
36+
*/
37+
initialize: function () {
3438
var self = this;
3539
this._super();
3640
url.setBaseUrl(window.authenticationPopup.baseUrl);
37-
loginAction.registerLoginCallback(function() {
41+
loginAction.registerLoginCallback(function () {
3842
self.isLoading(false);
3943
});
4044
},
@@ -47,13 +51,14 @@ define(
4751
},
4852

4953
/** Is login form enabled for current customer */
50-
isActive: function() {
54+
isActive: function () {
5155
var customer = customerData.get('customer');
56+
5257
return customer() == false;
5358
},
5459

5560
/** Show login popup window */
56-
showModal: function() {
61+
showModal: function () {
5762
if (this.modalWindow) {
5863
$(this.modalWindow).modal('openModal');
5964
} else {
@@ -64,15 +69,15 @@ define(
6469
},
6570

6671
/** Provide login action */
67-
login: function(loginForm) {
72+
login: function (loginForm) {
6873
var loginData = {},
6974
formDataArray = $(loginForm).serializeArray();
7075
formDataArray.forEach(function (entry) {
7176
loginData[entry.name] = entry.value;
7277
});
7378

74-
if($(loginForm).validation()
75-
&& $(loginForm).validation('isValid')
79+
if ($(loginForm).validation() &&
80+
$(loginForm).validation('isValid')
7681
) {
7782
this.isLoading(true);
7883
loginAction(loginData, null, false);

0 commit comments

Comments
 (0)