This is an automated email from the ASF dual-hosted git repository. ababiichuk pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/trunk by this push: new 867f4dc AMBARI-23579 Ambari shows invalid passwords as plaintext. (ababiichuk) 867f4dc is described below commit 867f4dc61831a328272781444d83628b5ded0566 Author: ababiichuk <ababiic...@hortonworks.com> AuthorDate: Fri Apr 13 20:00:23 2018 +0300 AMBARI-23579 Ambari shows invalid passwords as plaintext. (ababiichuk) --- ambari-web/app/mixins/common/serverValidator.js | 7 ++++--- ambari-web/test/mixins/common/serverValidator_test.js | 6 ++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ambari-web/app/mixins/common/serverValidator.js b/ambari-web/app/mixins/common/serverValidator.js index b60ae65..c44a6be 100644 --- a/ambari-web/app/mixins/common/serverValidator.js +++ b/ambari-web/app/mixins/common/serverValidator.js @@ -244,8 +244,8 @@ App.ServerValidatorMixin = Em.Mixin.create({ * @returns {{type: String, isError: boolean, isWarn: boolean, isGeneral: boolean, messages: Array}} */ createErrorMessage: function (type, property, messages) { - var errorTypes = this.get('errorTypes'); - var error = { + const errorTypes = this.get('errorTypes'); + let error = { type: type, isCriticalError: type === errorTypes.CRITICAL_ERROR, isError: type === errorTypes.ERROR, @@ -257,11 +257,12 @@ App.ServerValidatorMixin = Em.Mixin.create({ Em.assert('Unknown config error type ' + type, error.isError || error.isWarn || error.isGeneral || error.isCriticalError); if (property) { + const value = Em.get(property, 'value'); error.id = Em.get(property, 'id'); error.serviceName = Em.get(property, 'serviceDisplayName') || App.StackService.find(Em.get(property, 'serviceName')).get('displayName'); error.propertyName = Em.get(property, 'name'); error.filename = Em.get(property, 'filename'); - error.value = Em.get(property, 'value'); + error.value = value && Em.get(property, 'displayType') === 'password' ? new Array(value.length + 1).join('*') : value; error.description = Em.get(property, 'description'); } return error; diff --git a/ambari-web/test/mixins/common/serverValidator_test.js b/ambari-web/test/mixins/common/serverValidator_test.js index 3dbcaf4..284a97e 100644 --- a/ambari-web/test/mixins/common/serverValidator_test.js +++ b/ambari-web/test/mixins/common/serverValidator_test.js @@ -199,6 +199,12 @@ describe('App.ServerValidatorMixin', function () { expect(instanceObject.createErrorMessage.bind(instanceObject, 'WRONG TYPE', null, ['msg3'])) .to.throw(Error, 'Unknown config error type WRONG TYPE'); }); + + it('password config property', function () { + expect(instanceObject.createErrorMessage('ERROR', $.extend({}, property, { + displayType: 'password' + })).value).to.equal('**'); + }); }); }); -- To stop receiving notification emails like this one, please contact ababiic...@apache.org.