]> git.proxmox.com Git - proxmox-widget-toolkit.git/blame - window/PasswordEdit.js
do not override getSubmitValue, add note about strange semantics
[proxmox-widget-toolkit.git] / window / PasswordEdit.js
CommitLineData
ec62162d
DM
1Ext.define('Proxmox.window.PasswordEdit', {
2 extend: 'Proxmox.window.Edit',
c9441d5f
DM
3 alias: 'proxmoxWindowPasswordEdit',
4
5 initComponent : function() {
6 var me = this;
7
8 if (!me.userid) {
9 throw "no userid specified";
10 }
11
12 var verifypw;
13 var pwfield;
14
15 var validate_pw = function() {
16 if (verifypw.getValue() !== pwfield.getValue()) {
17 return gettext("Passwords does not match");
18 }
19 return true;
20 };
21
22 verifypw = Ext.createWidget('textfield', {
23 inputType: 'password',
24 fieldLabel: gettext('Confirm password'),
25 name: 'verifypassword',
26 submitValue: false,
27 validator: validate_pw
28 });
29
30 pwfield = Ext.createWidget('textfield', {
31 inputType: 'password',
32 fieldLabel: gettext('Password'),
33 minLength: 5,
34 name: 'password',
35 validator: validate_pw
36 });
37
38 Ext.apply(me, {
39 subject: gettext('Password'),
40 url: '/api2/extjs/access/password',
0f35d1ff
DM
41 fieldDefaults: {
42 labelWidth: 120
43 },
c9441d5f
DM
44 items: [
45 pwfield, verifypw,
46 {
47 xtype: 'hiddenfield',
48 name: 'userid',
49 value: me.userid
50 }
51 ]
52 });
53
54 me.callParent();
55 }
56});