diff --git a/apps/common/main/lib/component/InputField.js b/apps/common/main/lib/component/InputField.js
index 5d16292f6..8ea0d65a0 100644
--- a/apps/common/main/lib/component/InputField.js
+++ b/apps/common/main/lib/component/InputField.js
@@ -81,12 +81,11 @@ define([
template: _.template([
'
',
'" ',
+ 'type="text" ',
'name="<%= name %>" ',
'spellcheck="<%= spellcheck %>" ',
'class="form-control <%= cls %>" ',
'placeholder="<%= placeHolder %>" ',
- 'value="<%= value %>"',
'data-hint="<%= dataHint %>"',
'data-hint-direction="<%= dataHintDirection %>"',
'data-hint-offset="<%= dataHintOffset %>"',
@@ -165,6 +164,8 @@ define([
this._input.on('keydown', _.bind(this.onKeyDown, this));
this._input.on('keyup', _.bind(this.onKeyUp, 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);
}
@@ -183,9 +184,20 @@ define([
me.rendered = true;
+ if (me.value)
+ me.setValue(me.value);
+
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) {
// skip processing for internally-generated synthetic event
// to avoid double processing
@@ -303,6 +315,8 @@ define([
if (this.rendered){
this._input.val(value);
}
+
+ (this.type=='password') && this.checkPasswordType();
},
getValue: function() {
diff --git a/apps/common/main/lib/view/OpenDialog.js b/apps/common/main/lib/view/OpenDialog.js
index 4c796dc5c..313d4ad2f 100644
--- a/apps/common/main/lib/view/OpenDialog.js
+++ b/apps/common/main/lib/view/OpenDialog.js
@@ -202,20 +202,12 @@ define([
if (this.type == Common.Utils.importTextType.DRM) {
this.inputPwd = new Common.UI.InputField({
el: $('#id-password-txt'),
- type: 'text',
+ type: 'password',
validateOnBlur: false,
validation : function(value) {
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 {
this.initCodePages();
if (this.preview) {