window password edit: refactor to more schematic code

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2020-05-22 11:27:28 +02:00
parent 6dc34e5525
commit 18a6f207ef

View File

@ -1,13 +1,14 @@
Ext.define('Proxmox.window.PasswordEdit', { Ext.define('Proxmox.window.PasswordEdit', {
extend: 'Proxmox.window.Edit', extend: 'Proxmox.window.Edit',
alias: 'proxmoxWindowPasswordEdit', alias: 'proxmoxWindowPasswordEdit',
mixins: ['Proxmox.Mixin.CBind'],
subject: gettext('Password'), subject: gettext('Password'),
url: '/api2/extjs/access/password', url: '/api2/extjs/access/password',
fieldDefaults: { fieldDefaults: {
labelWidth: 120 labelWidth: 120,
}, },
items: [ items: [
@ -19,13 +20,9 @@ Ext.define('Proxmox.window.PasswordEdit', {
allowBlank: false, allowBlank: false,
name: 'password', name: 'password',
listeners: { listeners: {
change: function(field){ change: (field) => field.next().validate(),
field.next().validate(); blur: (field) => field.next().validate(),
}, },
blur: function(field){
field.next().validate();
}
}
}, },
{ {
xtype: 'textfield', xtype: 'textfield',
@ -35,22 +32,14 @@ Ext.define('Proxmox.window.PasswordEdit', {
allowBlank: false, allowBlank: false,
vtype: 'password', vtype: 'password',
initialPassField: 'password', initialPassField: 'password',
submitValue: false submitValue: false,
}, },
{ {
xtype: 'hiddenfield', xtype: 'hiddenfield',
name: 'userid' name: 'userid',
} cbind: {
value: '{userid}',
},
},
], ],
initComponent : function() {
var me = this;
if (!me.userid) {
throw "no userid specified";
}
me.callParent();
me.down('[name=userid]').setValue(me.userid);
}
}); });