extend: 'Proxmox.window.Edit',
alias: 'proxmoxWindowPasswordEdit',
- initComponent : function() {
- var me = this;
+ subject: gettext('Password'),
- if (!me.userid) {
- throw "no userid specified";
- }
+ url: '/api2/extjs/access/password',
- var verifypw;
- var pwfield;
+ fieldDefaults: {
+ labelWidth: 120
+ },
- var validate_pw = function() {
- if (verifypw.getValue() !== pwfield.getValue()) {
- return gettext("Passwords does not match");
+ items: [
+ {
+ xtype: 'textfield',
+ inputType: 'password',
+ fieldLabel: gettext('Password'),
+ minLength: 5,
+ name: 'password',
+ listeners: {
+ change: function(field){
+ field.next().validate();
+ },
+ blur: function(field){
+ field.next().validate();
+ }
}
- return true;
- };
-
- verifypw = Ext.createWidget('textfield', {
+ },
+ {
+ xtype: 'textfield',
inputType: 'password',
- fieldLabel: gettext('Confirm password'),
+ fieldLabel: gettext('Confirm password'),
name: 'verifypassword',
- submitValue: false,
- validator: validate_pw
- });
+ vtype: 'password',
+ initialPassField: 'password',
+ submitValue: false
+ },
+ {
+ xtype: 'hiddenfield',
+ name: 'userid'
+ }
+ ],
- pwfield = Ext.createWidget('textfield', {
- inputType: 'password',
- fieldLabel: gettext('Password'),
- minLength: 5,
- name: 'password',
- validator: validate_pw
- });
+ initComponent : function() {
+ var me = this;
- Ext.apply(me, {
- subject: gettext('Password'),
- url: '/api2/extjs/access/password',
- fieldDefaults: {
- labelWidth: 120
- },
- items: [
- pwfield, verifypw,
- {
- xtype: 'hiddenfield',
- name: 'userid',
- value: me.userid
- }
- ]
- });
+ if (!me.userid) {
+ throw "no userid specified";
+ }
me.callParent();
+ me.down('[name=userid]').setValue(me.userid);
}
});