Merge pull request #1796 from ONLYOFFICE/fix/bug-56817

For Bug 56817 (depends on Bug 49947)
This commit is contained in:
Julia Radzhabova 2022-06-10 18:10:28 +03:00 committed by GitHub
commit 57f3d5e436
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -81,7 +81,7 @@ define([
template: _.template([ template: _.template([
'<div class="input-field" style="<%= style %>">', '<div class="input-field" style="<%= style %>">',
'<input ', '<input ',
'type="text" ', 'type="<%= type %>" ',
'name="<%= name %>" ', 'name="<%= name %>" ',
'spellcheck="<%= spellcheck %>" ', 'spellcheck="<%= spellcheck %>" ',
'class="form-control <%= cls %>" ', 'class="form-control <%= cls %>" ',
@ -164,8 +164,6 @@ 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);
} }
@ -190,15 +188,6 @@ define([
return this; return this;
}, },
checkPasswordType: function(){
if(this.type == 'text') return;
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
@ -317,8 +306,6 @@ define([
if (this.rendered){ if (this.rendered){
this._input.val(value); this._input.val(value);
} }
(this.type=='password') && this.checkPasswordType();
}, },
getValue: function() { getValue: function() {
@ -438,7 +425,7 @@ define([
template: _.template([ template: _.template([
'<div class="input-field input-field-btn" style="<%= style %>">', '<div class="input-field input-field-btn" style="<%= style %>">',
'<input ', '<input ',
'type="text" ', 'type=<%= type %> ',
'name="<%= name %>" ', 'name="<%= name %>" ',
'spellcheck="<%= spellcheck %>" ', 'spellcheck="<%= spellcheck %>" ',
'class="form-control <%= cls %>" ', 'class="form-control <%= cls %>" ',
@ -562,6 +549,7 @@ define([
style: '', style: '',
value: '', value: '',
name: '', name: '',
type: 'password',
validation: null, validation: null,
allowBlank: true, allowBlank: true,
placeHolder: '', placeHolder: '',
@ -594,7 +582,6 @@ define([
Common.UI.InputFieldBtn.prototype.render.call(this, parentEl); Common.UI.InputFieldBtn.prototype.render.call(this, parentEl);
this._btnElm = this._button.$el; this._btnElm = this._button.$el;
this._input.on('input', _.bind(this.checkPasswordType, this));
if(this.options.showPwdOnClick) if(this.options.showPwdOnClick)
this._button.on('click', _.bind(this.passwordClick, this)); this._button.on('click', _.bind(this.passwordClick, this));
else else
@ -647,10 +634,10 @@ define([
this._button.setIconCls(this.options.showCls); this._button.setIconCls(this.options.showCls);
this.type = 'password'; this.type = 'password';
(this._input.val() !== '') && this._input.attr('type', this.type); this._input.attr('type', this.type);
if(this.repeatInput) { if(this.repeatInput) {
this.repeatInput.type = this.type; this.repeatInput.type = this.type;
(this.repeatInput._input.val() !== '') && this.repeatInput._input.attr('type', this.type); this.repeatInput._input.attr('type', this.type);
} }
if(this.options.showPwdOnClick) { if(this.options.showPwdOnClick) {