public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup 1/2] ui: add missing unlockTfa handler
@ 2023-06-27 10:04 Lukas Wagner
  2023-06-27 10:04 ` [pbs-devel] [PATCH proxmox-backup 2/2] ui: fix refresh after TFA unlock Lukas Wagner
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Lukas Wagner @ 2023-06-27 10:04 UTC (permalink / raw)
  To: pbs-devel; +Cc: Wolfgang Bumiller

From: Wolfgang Bumiller <w.bumiller@proxmox.com>

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
---
 www/config/UserView.js | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/www/config/UserView.js b/www/config/UserView.js
index 5a5b2f4e..9a0a0b2b 100644
--- a/www/config/UserView.js
+++ b/www/config/UserView.js
@@ -100,6 +100,30 @@ Ext.define('PBS.config.UserView', {
 	init: function(view) {
 	    Proxmox.Utils.monStoreErrors(view, view.getStore().rstore);
 	},
+
+	unlockTfa: function(btn, event, rec) {
+	    let me = this;
+	    let view = me.getView();
+	    Ext.Msg.confirm(
+		Ext.String.format(gettext('Unlock TFA authentication for {0}'), rec.data.userid),
+		gettext("Locked 2nd factors can happen if the user's password was leaked. Are you sure you want to unlock the user?"),
+		function(btn_response) {
+		    if (btn_response === 'yes') {
+			Proxmox.Utils.API2Request({
+			    url: `/access/users/${rec.data.userid}/unlock-tfa`,
+			    waitMsgTarget: view,
+			    method: 'PUT',
+			    failure: function(response, options) {
+				Ext.Msg.alert(gettext('Error'), response.htmlStatus);
+			    },
+			    success: function(response, options) {
+				me.reload();
+			    },
+			});
+		    }
+		},
+	    );
+	},
     },
 
     listeners: {
-- 
2.39.2





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

* [pbs-devel] [PATCH proxmox-backup 2/2] ui: fix refresh after TFA unlock
  2023-06-27 10:04 [pbs-devel] [PATCH proxmox-backup 1/2] ui: add missing unlockTfa handler Lukas Wagner
@ 2023-06-27 10:04 ` Lukas Wagner
  2023-06-27 11:29   ` Dominik Csapak
  2023-06-27 11:28 ` [pbs-devel] [PATCH proxmox-backup 1/2] ui: add missing unlockTfa handler Dominik Csapak
  2023-06-27 11:32 ` [pbs-devel] applied: " Thomas Lamprecht
  2 siblings, 1 reply; 6+ messages in thread
From: Lukas Wagner @ 2023-06-27 10:04 UTC (permalink / raw)
  To: pbs-devel

Problem was that refresh after unlock did not work properly.
Also calling load on the outer store seems to fix it, but I'm
not sure why. Judging from the code in `DiffStore.js`, the
outer store seems be subscribed to the `load` event from `rstore`,
performing a load itself if the event occurs.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
---
 www/config/UserView.js | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/www/config/UserView.js b/www/config/UserView.js
index 9a0a0b2b..168af902 100644
--- a/www/config/UserView.js
+++ b/www/config/UserView.js
@@ -95,7 +95,10 @@ Ext.define('PBS.config.UserView', {
 	    return Ext.String.htmlEncode(userid.match(/^(.+)@([^@]+)$/)[2]);
 	},
 
-	reload: function() { this.getView().getStore().rstore.load(); },
+	reload: function() {
+	    this.getView().getStore().rstore.load();
+	    this.getView().getStore().load();
+	},
 
 	init: function(view) {
 	    Proxmox.Utils.monStoreErrors(view, view.getStore().rstore);
-- 
2.39.2





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

* Re: [pbs-devel] [PATCH proxmox-backup 1/2] ui: add missing unlockTfa handler
  2023-06-27 10:04 [pbs-devel] [PATCH proxmox-backup 1/2] ui: add missing unlockTfa handler Lukas Wagner
  2023-06-27 10:04 ` [pbs-devel] [PATCH proxmox-backup 2/2] ui: fix refresh after TFA unlock Lukas Wagner
@ 2023-06-27 11:28 ` Dominik Csapak
  2023-06-27 11:32 ` [pbs-devel] applied: " Thomas Lamprecht
  2 siblings, 0 replies; 6+ messages in thread
From: Dominik Csapak @ 2023-06-27 11:28 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Lukas Wagner
  Cc: Wolfgang Bumiller

consider this first patch

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






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

* Re: [pbs-devel] [PATCH proxmox-backup 2/2] ui: fix refresh after TFA unlock
  2023-06-27 10:04 ` [pbs-devel] [PATCH proxmox-backup 2/2] ui: fix refresh after TFA unlock Lukas Wagner
@ 2023-06-27 11:29   ` Dominik Csapak
  2023-06-27 11:30     ` Lukas Wagner
  0 siblings, 1 reply; 6+ messages in thread
From: Dominik Csapak @ 2023-06-27 11:29 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Lukas Wagner

while it does work, the correct way to fix this is to add the column dataindex
to the model definition, since that is what the diffstore uses to update it's
data on a load

i sent a fix for that, which is intended to be applied instead of this patch:

https://lists.proxmox.com/pipermail/pbs-devel/2023-June/006244.html

On 6/27/23 12:04, Lukas Wagner wrote:
> Problem was that refresh after unlock did not work properly.
> Also calling load on the outer store seems to fix it, but I'm
> not sure why. Judging from the code in `DiffStore.js`, the
> outer store seems be subscribed to the `load` event from `rstore`,
> performing a load itself if the event occurs.
> 
> Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
> ---
>   www/config/UserView.js | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/www/config/UserView.js b/www/config/UserView.js
> index 9a0a0b2b..168af902 100644
> --- a/www/config/UserView.js
> +++ b/www/config/UserView.js
> @@ -95,7 +95,10 @@ Ext.define('PBS.config.UserView', {
>   	    return Ext.String.htmlEncode(userid.match(/^(.+)@([^@]+)$/)[2]);
>   	},
>   
> -	reload: function() { this.getView().getStore().rstore.load(); },
> +	reload: function() {
> +	    this.getView().getStore().rstore.load();
> +	    this.getView().getStore().load();
> +	},
>   
>   	init: function(view) {
>   	    Proxmox.Utils.monStoreErrors(view, view.getStore().rstore);





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

* Re: [pbs-devel] [PATCH proxmox-backup 2/2] ui: fix refresh after TFA unlock
  2023-06-27 11:29   ` Dominik Csapak
@ 2023-06-27 11:30     ` Lukas Wagner
  0 siblings, 0 replies; 6+ messages in thread
From: Lukas Wagner @ 2023-06-27 11:30 UTC (permalink / raw)
  To: Dominik Csapak, Proxmox Backup Server development discussion



On 6/27/23 13:29, Dominik Csapak wrote:
> while it does work, the correct way to fix this is to add the column dataindex
> to the model definition, since that is what the diffstore uses to update it's
> data on a load
> 
> i sent a fix for that, which is intended to be applied instead of this patch:
> 
Ahh, that makes a whole lot more sense.
Thanks for the fixup!

-- 
- Lukas




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

* [pbs-devel] applied: [PATCH proxmox-backup 1/2] ui: add missing unlockTfa handler
  2023-06-27 10:04 [pbs-devel] [PATCH proxmox-backup 1/2] ui: add missing unlockTfa handler Lukas Wagner
  2023-06-27 10:04 ` [pbs-devel] [PATCH proxmox-backup 2/2] ui: fix refresh after TFA unlock Lukas Wagner
  2023-06-27 11:28 ` [pbs-devel] [PATCH proxmox-backup 1/2] ui: add missing unlockTfa handler Dominik Csapak
@ 2023-06-27 11:32 ` Thomas Lamprecht
  2 siblings, 0 replies; 6+ messages in thread
From: Thomas Lamprecht @ 2023-06-27 11:32 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Lukas Wagner
  Cc: Wolfgang Bumiller

Am 27/06/2023 um 12:04 schrieb Lukas Wagner:
> From: Wolfgang Bumiller <w.bumiller@proxmox.com>
> 
> Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
> ---
>  www/config/UserView.js | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
>

applied, thanks!




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

end of thread, other threads:[~2023-06-27 11:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-27 10:04 [pbs-devel] [PATCH proxmox-backup 1/2] ui: add missing unlockTfa handler Lukas Wagner
2023-06-27 10:04 ` [pbs-devel] [PATCH proxmox-backup 2/2] ui: fix refresh after TFA unlock Lukas Wagner
2023-06-27 11:29   ` Dominik Csapak
2023-06-27 11:30     ` Lukas Wagner
2023-06-27 11:28 ` [pbs-devel] [PATCH proxmox-backup 1/2] ui: add missing unlockTfa handler Dominik Csapak
2023-06-27 11:32 ` [pbs-devel] applied: " Thomas Lamprecht

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