From c9441d5f324f70b248011071a009fb544df61de8 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Mon, 27 Mar 2017 08:14:46 +0200 Subject: [PATCH] window/PasswordEdit.js: copied from pve-manager --- Makefile | 1 + window/PasswordEdit.js | 53 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 window/PasswordEdit.js diff --git a/Makefile b/Makefile index 4c88222..b84c1f6 100644 --- a/Makefile +++ b/Makefile @@ -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 \ diff --git a/window/PasswordEdit.js b/window/PasswordEdit.js new file mode 100644 index 0000000..db47714 --- /dev/null +++ b/window/PasswordEdit.js @@ -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(); + } +}); -- 2.39.2