]>
Commit | Line | Data |
---|---|---|
c9441d5f DM |
1 | xt.define('Proxmox.window.PasswordEdit', { |
2 | extend: 'PVE.window.Edit', | |
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', | |
41 | items: [ | |
42 | pwfield, verifypw, | |
43 | { | |
44 | xtype: 'hiddenfield', | |
45 | name: 'userid', | |
46 | value: me.userid | |
47 | } | |
48 | ] | |
49 | }); | |
50 | ||
51 | me.callParent(); | |
52 | } | |
53 | }); |