Fix Bug 49947

This commit is contained in:
Julia Radzhabova 2021-08-31 23:55:22 +03:00
parent f0939c6a2b
commit ff53ec1547
2 changed files with 17 additions and 11 deletions

View file

@ -81,12 +81,11 @@ define([
template: _.template([ template: _.template([
'<div class="input-field" style="<%= style %>">', '<div class="input-field" style="<%= style %>">',
'<input ', '<input ',
'type="<%= type %>" ', 'type="text" ',
'name="<%= name %>" ', 'name="<%= name %>" ',
'spellcheck="<%= spellcheck %>" ', 'spellcheck="<%= spellcheck %>" ',
'class="form-control <%= cls %>" ', 'class="form-control <%= cls %>" ',
'placeholder="<%= placeHolder %>" ', 'placeholder="<%= placeHolder %>" ',
'value="<%= value %>"',
'data-hint="<%= dataHint %>"', 'data-hint="<%= dataHint %>"',
'data-hint-direction="<%= dataHintDirection %>"', 'data-hint-direction="<%= dataHintDirection %>"',
'data-hint-offset="<%= dataHintOffset %>"', 'data-hint-offset="<%= dataHintOffset %>"',
@ -165,6 +164,8 @@ define([
this._input.on('keydown', _.bind(this.onKeyDown, this)); this._input.on('keydown', _.bind(this.onKeyDown, this));
this._input.on('keyup', _.bind(this.onKeyUp, this)); this._input.on('keyup', _.bind(this.onKeyUp, this));
if (this.validateOnChange) this._input.on('input', _.bind(this.onInputChanging, this)); if (this.validateOnChange) this._input.on('input', _.bind(this.onInputChanging, this));
if (this.type=='password') this._input.on('input', _.bind(this.checkPasswordType, this));
if (this.maxLength) this._input.attr('maxlength', this.maxLength); if (this.maxLength) this._input.attr('maxlength', this.maxLength);
} }
@ -183,9 +184,20 @@ define([
me.rendered = true; me.rendered = true;
if (me.value)
me.setValue(me.value);
return this; return this;
}, },
checkPasswordType: function(){
if (this._input.val() !== '') {
(this._input.attr('type') !== 'password') && this._input.attr('type', 'password');
} else {
this._input.attr('type', 'text');
}
},
_doChange: function(e, extra) { _doChange: function(e, extra) {
// skip processing for internally-generated synthetic event // skip processing for internally-generated synthetic event
// to avoid double processing // to avoid double processing
@ -303,6 +315,8 @@ define([
if (this.rendered){ if (this.rendered){
this._input.val(value); this._input.val(value);
} }
(this.type=='password') && this.checkPasswordType();
}, },
getValue: function() { getValue: function() {

View file

@ -202,20 +202,12 @@ define([
if (this.type == Common.Utils.importTextType.DRM) { if (this.type == Common.Utils.importTextType.DRM) {
this.inputPwd = new Common.UI.InputField({ this.inputPwd = new Common.UI.InputField({
el: $('#id-password-txt'), el: $('#id-password-txt'),
type: 'text', type: 'password',
validateOnBlur: false, validateOnBlur: false,
validation : function(value) { validation : function(value) {
return me.txtIncorrectPwd; return me.txtIncorrectPwd;
} }
}); });
this.$window.find('input').on('input', function(){
if ($(this).val() !== '') {
($(this).attr('type') !== 'password') && $(this).attr('type', 'password');
} else {
$(this).attr('type', 'text');
}
});
} else { } else {
this.initCodePages(); this.initCodePages();
if (this.preview) { if (this.preview) {