window/PasswordEdit.js: copied from pve-manager

This commit is contained in:
Dietmar Maurer 2017-03-27 08:14:46 +02:00
parent 066babdc65
commit c9441d5f32
2 changed files with 54 additions and 0 deletions

View File

@ -31,6 +31,7 @@ JSSRC= \
panel/InputPanel.js \
panel/LogView.js \
window/Edit.js \
window/PasswordEdit.js \
window/TaskViewer.js \
node/NetworkEdit.js \
node/NetworkView.js \

53
window/PasswordEdit.js Normal file
View File

@ -0,0 +1,53 @@
xt.define('Proxmox.window.PasswordEdit', {
extend: 'PVE.window.Edit',
alias: 'proxmoxWindowPasswordEdit',
initComponent : function() {
var me = this;
if (!me.userid) {
throw "no userid specified";
}
var verifypw;
var pwfield;
var validate_pw = function() {
if (verifypw.getValue() !== pwfield.getValue()) {
return gettext("Passwords does not match");
}
return true;
};
verifypw = Ext.createWidget('textfield', {
inputType: 'password',
fieldLabel: gettext('Confirm password'),
name: 'verifypassword',
submitValue: false,
validator: validate_pw
});
pwfield = Ext.createWidget('textfield', {
inputType: 'password',
fieldLabel: gettext('Password'),
minLength: 5,
name: 'password',
validator: validate_pw
});
Ext.apply(me, {
subject: gettext('Password'),
url: '/api2/extjs/access/password',
items: [
pwfield, verifypw,
{
xtype: 'hiddenfield',
name: 'userid',
value: me.userid
}
]
});
me.callParent();
}
});