Skip to content

Commit

Permalink
Merge pull request #1489 from magento-plankton/2.2-bugs
Browse files Browse the repository at this point in the history
[Plankton] Bugs
  • Loading branch information
Alexander Akimov authored Sep 14, 2017
2 parents 0c0393d + 5adc99f commit 5ea58a5
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 8 deletions.
23 changes: 23 additions & 0 deletions app/code/Magento/Checkout/view/frontend/web/js/checkout-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,29 @@ define([

obj.inputFieldEmailValue = email;
saveData(obj);
},

/**
* Pulling the checked email value from persistence storage
*
* @return {*}
*/
getCheckedEmailValue: function () {
var obj = getData();

return obj.checkedEmailValue ? obj.checkedEmailValue : '';
},

/**
* Setting the checked email value pulled from persistence storage
*
* @param {String} email
*/
setCheckedEmailValue: function (email) {
var obj = getData();

obj.checkedEmailValue = email;
saveData(obj);
}
};
});
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ define([
return this;
},

/** @inheritdoc */
initConfig: function () {
this._super();

this.isPasswordVisible = this.resolveInitialPasswordVisibility();

return this;
},

/**
* Callback on changing email property
*/
Expand Down Expand Up @@ -81,20 +90,19 @@ define([
* Check email existing.
*/
checkEmailAvailability: function () {
var self = this;

this.validateRequest();
this.isEmailCheckComplete = $.Deferred();
this.isLoading(true);
this.checkRequest = checkEmailAvailability(this.isEmailCheckComplete, this.email());

$.when(this.isEmailCheckComplete).done(function () {
self.isPasswordVisible(false);
}).fail(function () {
self.isPasswordVisible(true);
}).always(function () {
self.isLoading(false);
});
this.isPasswordVisible(false);
}.bind(this)).fail(function () {
this.isPasswordVisible(true);
checkoutData.setCheckedEmailValue(this.email());
}.bind(this)).always(function () {
this.isLoading(false);
}.bind(this));
},

/**
Expand Down Expand Up @@ -153,6 +161,19 @@ define([
fullScreenLoader.stopLoader();
});
}
},

/**
* Resolves an initial sate of a login form.
*
* @returns {Boolean} - initial visibility state.
*/
resolveInitialPasswordVisibility: function () {
if (checkoutData.getInputFieldEmailValue() !== '') {
return checkoutData.getInputFieldEmailValue() === checkoutData.getCheckedEmailValue();
}

return false;
}
});
});

0 comments on commit 5ea58a5

Please sign in to comment.