Allow to show plain text in password field
issue5607 review33721002
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
* Allow to show plain text in password field
|
||||
|
||||
Version 4.2.0 - 2016-11-28
|
||||
* Bug fixes (see mercurial logs for details)
|
||||
* Add PYSON Widget
|
||||
|
||||
@@ -1276,6 +1276,32 @@ function eval_pyson(value){
|
||||
Sao.View.Form.Password._super.init.call(this, field_name, model,
|
||||
attributes);
|
||||
this.input.prop('type', 'password');
|
||||
this.button = jQuery('<button/>', {
|
||||
'class': 'btn btn-default btn-sm form-control',
|
||||
'type': 'button'
|
||||
}).appendTo(jQuery('<span/>', {
|
||||
'class': 'input-group-btn'
|
||||
}).appendTo(this.group));
|
||||
this._set_password_label();
|
||||
this.button.click(this.toggle_visibility.bind(this));
|
||||
|
||||
},
|
||||
toggle_visibility: function() {
|
||||
if (this.input.prop('type') == 'password') {
|
||||
this.input.prop('type', 'text');
|
||||
this.input.attr('autocomplete', 'off');
|
||||
} else {
|
||||
this.input.prop('type', 'password');
|
||||
this.input.removeAttr('autocomplete');
|
||||
}
|
||||
this._set_password_label();
|
||||
},
|
||||
_set_password_label: function() {
|
||||
if (this.input.prop('type') == 'password') {
|
||||
this.button.text(Sao.i18n.gettext('Show'));
|
||||
} else {
|
||||
this.button.text(Sao.i18n.gettext('Hide'));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user