public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup] gui: user: fix #2898 add dialog to set password
@ 2020-07-29  8:33 Aaron Lauterer
  2020-07-30  8:22 ` Dominik Csapak
  0 siblings, 1 reply; 3+ messages in thread
From: Aaron Lauterer @ 2020-07-29  8:33 UTC (permalink / raw)
  To: pbs-devel

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
---
 www/Makefile               |  1 +
 www/config/UserView.js     | 18 ++++++++++++++
 www/window/UserPassword.js | 49 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 68 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..ed1c2e32
--- /dev/null
+++ b/www/window/UserPassword.js
@@ -0,0 +1,49 @@
+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,
+	},
+    ],
+
+    getValues: function(dirtyOnly) {
+	var me = this;
+
+	var values = me.callParent(arguments);
+
+	return values;
+    },
+});
-- 
2.20.1





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [pbs-devel] [PATCH proxmox-backup] gui: user: fix #2898 add dialog to set password
  2020-07-29  8:33 [pbs-devel] [PATCH proxmox-backup] gui: user: fix #2898 add dialog to set password Aaron Lauterer
@ 2020-07-30  8:22 ` Dominik Csapak
  2020-08-03  9:45   ` Aaron Lauterer
  0 siblings, 1 reply; 3+ messages in thread
From: Dominik Csapak @ 2020-07-30  8:22 UTC (permalink / raw)
  To: pbs-devel

works as intended, one nit inline

other than that:

Reviewed-By: Dominik Csapak <d.csapak@proxmox.com>
Tested-By: Dominik Csapak <d.csapak@proxmox.com>

On 7/29/20 10:33 AM, Aaron Lauterer wrote:
> Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
> ---
>   www/Makefile               |  1 +
>   www/config/UserView.js     | 18 ++++++++++++++
>   www/window/UserPassword.js | 49 ++++++++++++++++++++++++++++++++++++++
>   3 files changed, 68 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..ed1c2e32
> --- /dev/null
> +++ b/www/window/UserPassword.js
> @@ -0,0 +1,49 @@
> +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,
> +	},
> +    ],
> +
> +    getValues: function(dirtyOnly) {
> +	var me = this;
> +
> +	var values = me.callParent(arguments);
> +
> +	return values;
> +    },

if we only call callParent, is it necessary to have it at all?

> +});
> 





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [pbs-devel] [PATCH proxmox-backup] gui: user: fix #2898 add dialog to set password
  2020-07-30  8:22 ` Dominik Csapak
@ 2020-08-03  9:45   ` Aaron Lauterer
  0 siblings, 0 replies; 3+ messages in thread
From: Aaron Lauterer @ 2020-08-03  9:45 UTC (permalink / raw)
  To: pbs-devel



On 7/30/20 10:22 AM, Dominik Csapak wrote:
> works as intended, one nit inline
> 
> other than that:
> 
> Reviewed-By: Dominik Csapak <d.csapak@proxmox.com>
> Tested-By: Dominik Csapak <d.csapak@proxmox.com>
> 
>> +
>> +    getValues: function(dirtyOnly) {
>> +    var me = this;
>> +
>> +    var values = me.callParent(arguments);
>> +
>> +    return values;
>> +    },
> 
> if we only call callParent, is it necessary to have it at all?

You are right. Forgot to strip that after copy and pasta. Will send a v2.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-03  9:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-29  8:33 [pbs-devel] [PATCH proxmox-backup] gui: user: fix #2898 add dialog to set password Aaron Lauterer
2020-07-30  8:22 ` Dominik Csapak
2020-08-03  9:45   ` Aaron Lauterer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal