all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Aaron Lauterer <a.lauterer@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH v2 proxmox-backup] gui: user: fix #2898 add dialog to set password
Date: Mon,  3 Aug 2020 11:56:25 +0200	[thread overview]
Message-ID: <20200803095625.23811-1-a.lauterer@proxmox.com> (raw)

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
---
v1->v2:
remove unnecessary getValues() call

 www/Makefile               |  1 +
 www/config/UserView.js     | 18 +++++++++++++++++
 www/window/UserPassword.js | 41 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 60 insertions(+)
 create mode 100644 www/window/UserPassword.js

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,
+	},
+    ],
+});
-- 
2.20.1





             reply	other threads:[~2020-08-03  9:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-03  9:56 Aaron Lauterer [this message]
2020-08-04  9:10 ` [pbs-devel] applied: " Dietmar Maurer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200803095625.23811-1-a.lauterer@proxmox.com \
    --to=a.lauterer@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal