]> git.proxmox.com Git - proxmox-backup.git/commitdiff
gui: user: fix #2898 add dialog to set password
authorAaron Lauterer <a.lauterer@proxmox.com>
Mon, 3 Aug 2020 09:56:25 +0000 (11:56 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 4 Aug 2020 08:21:00 +0000 (10:21 +0200)
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
www/Makefile
www/config/UserView.js
www/window/UserPassword.js [new file with mode: 0644]

index d8c91a1869c551ea1e461c23579209d9bcb4b5c8..edce8cb38c82d9253f1ce555d99bb6c89103e285 100644 (file)
@@ -18,6 +18,7 @@ JSSRC=                                                        \
        config/SyncView.js                              \
        config/DataStoreConfig.js                       \
        window/UserEdit.js                              \
+       window/UserPassword.js                          \
        window/RemoteEdit.js                            \
        window/SyncJobEdit.js                           \
        window/ACLEdit.js                               \
index 7a869d44cf0b5726493fe9cd82b50eabe14f0b9a..91e7a83ae5e5adf1b68429013f0aa1fbb561d29f 100644 (file)
@@ -51,6 +51,18 @@ Ext.define('PBS.config.UserView', {
             }).show();
        },
 
+       setPassword: function() {
+           let me = this;
+           let view = me.getView();
+           let selection = view.getSelection();
+
+           if (selection.length < 1) return;
+
+           Ext.create('PBS.window.UserPassword', {
+               url: '/api2/extjs/access/users/' + selection[0].data.userid,
+           }).show();
+       },
+
        renderUsername: function(userid) {
            return Ext.String.htmlEncode(userid.match(/^(.+)@([^@]+)$/)[1]);
        },
@@ -98,6 +110,12 @@ Ext.define('PBS.config.UserView', {
            handler: 'editUser',
            disabled: true,
        },
+       {
+           xtype: 'proxmoxButton',
+           text: gettext('Password'),
+           handler: 'setPassword',
+           disabled: true,
+       },
        {
            xtype: 'proxmoxStdRemoveButton',
            baseurl: '/access/users/',
diff --git a/www/window/UserPassword.js b/www/window/UserPassword.js
new file mode 100644 (file)
index 0000000..803ab0b
--- /dev/null
@@ -0,0 +1,41 @@
+Ext.define('PBS.window.UserPassword', {
+    extend: 'Proxmox.window.Edit',
+    alias: 'widget.pbsUserPassword',
+
+    userid: undefined,
+
+    method: 'PUT',
+
+    subject: gettext('User Password'),
+
+    fieldDefaults: { labelWidth: 120 },
+
+    items: [
+       {
+           xtype: 'textfield',
+           inputType: 'password',
+           fieldLabel: gettext('Password'),
+           minLength: 5,
+           allowBlank: false,
+           name: 'password',
+           listeners: {
+               change: function(field) {
+                   field.next().validate();
+               },
+               blur: function(field) {
+                   field.next().validate();
+               },
+           },
+       },
+       {
+           xtype: 'textfield',
+           inputType: 'password',
+           fieldLabel: gettext('Confirm password'),
+           name: 'verifypassword',
+           vtype: 'password',
+           initialPassField: 'password',
+           allowBlank: false,
+           submitValue: false,
+       },
+    ],
+});