From: Aaron Lauterer Date: Mon, 3 Aug 2020 09:56:25 +0000 (+0200) Subject: gui: user: fix #2898 add dialog to set password X-Git-Tag: v0.8.10~31 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=16f0afbfb506da3ead8d542c20f9563d7009f0e9;p=proxmox-backup.git gui: user: fix #2898 add dialog to set password Signed-off-by: Aaron Lauterer --- diff --git a/www/Makefile b/www/Makefile index d8c91a18..edce8cb3 100644 --- a/www/Makefile +++ b/www/Makefile @@ -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 \ diff --git a/www/config/UserView.js b/www/config/UserView.js index 7a869d44..91e7a83a 100644 --- a/www/config/UserView.js +++ b/www/config/UserView.js @@ -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 index 00000000..803ab0b6 --- /dev/null +++ b/www/window/UserPassword.js @@ -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, + }, + ], +});