all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager 1/2] ui: user view: show tfa lock status
@ 2023-06-06 10:05 Wolfgang Bumiller
  2023-06-06 10:05 ` [pve-devel] [PATCH manager 2/2] ui: user view: add 'Unlock TFA' button Wolfgang Bumiller
  2023-06-07 16:08 ` [pve-devel] applied: [PATCH manager 1/2] ui: user view: show tfa lock status Thomas Lamprecht
  0 siblings, 2 replies; 4+ messages in thread
From: Wolfgang Bumiller @ 2023-06-06 10:05 UTC (permalink / raw)
  To: pve-devel

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

diff --git a/www/manager6/dc/UserView.js b/www/manager6/dc/UserView.js
index bbfc4f7c..e46ed13e 100644
--- a/www/manager6/dc/UserView.js
+++ b/www/manager6/dc/UserView.js
@@ -158,17 +158,31 @@ Ext.define('PVE.dc.UserView', {
 		},
 		{
 		    header: 'TFA',
-		    width: 50,
+		    width: 120,
 		    sortable: true,
-		    renderer: function(v) {
+		    renderer: function(v, metaData, record) {
 			let tfa_type = PVE.Parser.parseTfaType(v);
 			if (tfa_type === undefined) {
 			    return Proxmox.Utils.noText;
-			} else if (tfa_type === 1) {
-			    return Proxmox.Utils.yesText;
-			} else {
+			}
+
+			if (tfa_type !== 1) {
 			    return tfa_type;
 			}
+
+			let locked_until = record.data['tfa-locked-until'];
+			if (locked_until !== undefined) {
+			    let now = new Date().getTime() / 1000;
+			    if (locked_until > now) {
+				return gettext('Locked');
+			    }
+			}
+
+			if (record.data['totp-locked']) {
+			    return gettext('TOTP Locked');
+			}
+
+			return Proxmox.Utils.yesText;
 		    },
 		    dataIndex: 'keys',
 		},
-- 
2.39.2





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

* [pve-devel] [PATCH manager 2/2] ui: user view: add 'Unlock TFA' button
  2023-06-06 10:05 [pve-devel] [PATCH manager 1/2] ui: user view: show tfa lock status Wolfgang Bumiller
@ 2023-06-06 10:05 ` Wolfgang Bumiller
  2023-06-07 16:08   ` [pve-devel] applied: " Thomas Lamprecht
  2023-06-07 16:08 ` [pve-devel] applied: [PATCH manager 1/2] ui: user view: show tfa lock status Thomas Lamprecht
  1 sibling, 1 reply; 4+ messages in thread
From: Wolfgang Bumiller @ 2023-06-06 10:05 UTC (permalink / raw)
  To: pve-devel

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

diff --git a/www/manager6/dc/UserView.js b/www/manager6/dc/UserView.js
index e46ed13e..fec45deb 100644
--- a/www/manager6/dc/UserView.js
+++ b/www/manager6/dc/UserView.js
@@ -93,6 +93,35 @@ Ext.define('PVE.dc.UserView', {
 	    },
 	});
 
+	let unlock_btn = new Proxmox.button.Button({
+	    text: gettext('Unlock TFA'),
+	    disabled: true,
+	    selModel: sm,
+	    enableFn: rec => !!(caps.access['User.Modify'] &&
+	        (rec.data['totp-locked'] || rec.data['tfa-locked-until'])),
+	    handler: function(btn, event, rec) {
+		Ext.Msg.confirm(
+		    gettext(Ext.String.format('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: me,
+				method: 'PUT',
+				failure: function(response, options) {
+				    Ext.Msg.alert(gettext('Error'), response.htmlStatus);
+				},
+				success: function(response, options) {
+				    reload();
+				},
+			    });
+			}
+		    },
+		);
+	    },
+	});
+
 	Ext.apply(me, {
 	    store: store,
 	    selModel: sm,
@@ -116,6 +145,8 @@ Ext.define('PVE.dc.UserView', {
 		pwchange_btn,
 		'-',
 		perm_btn,
+		'-',
+		unlock_btn,
 	    ],
 	    viewConfig: {
 		trackOver: false,
-- 
2.39.2





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

* [pve-devel] applied: [PATCH manager 1/2] ui: user view: show tfa lock status
  2023-06-06 10:05 [pve-devel] [PATCH manager 1/2] ui: user view: show tfa lock status Wolfgang Bumiller
  2023-06-06 10:05 ` [pve-devel] [PATCH manager 2/2] ui: user view: add 'Unlock TFA' button Wolfgang Bumiller
@ 2023-06-07 16:08 ` Thomas Lamprecht
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2023-06-07 16:08 UTC (permalink / raw)
  To: Proxmox VE development discussion, Wolfgang Bumiller

Am 06/06/2023 um 12:05 schrieb Wolfgang Bumiller:
> Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
> ---
>  www/manager6/dc/UserView.js | 24 +++++++++++++++++++-----
>  1 file changed, 19 insertions(+), 5 deletions(-)
> 
>

applied, thanks!




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

* [pve-devel] applied: [PATCH manager 2/2] ui: user view: add 'Unlock TFA' button
  2023-06-06 10:05 ` [pve-devel] [PATCH manager 2/2] ui: user view: add 'Unlock TFA' button Wolfgang Bumiller
@ 2023-06-07 16:08   ` Thomas Lamprecht
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2023-06-07 16:08 UTC (permalink / raw)
  To: Proxmox VE development discussion, Wolfgang Bumiller

Am 06/06/2023 um 12:05 schrieb Wolfgang Bumiller:
> Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
> ---
>  www/manager6/dc/UserView.js | 31 +++++++++++++++++++++++++++++++
>  1 file changed, 31 insertions(+)
> 
>

applied, thanks!




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

end of thread, other threads:[~2023-06-07 16:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-06 10:05 [pve-devel] [PATCH manager 1/2] ui: user view: show tfa lock status Wolfgang Bumiller
2023-06-06 10:05 ` [pve-devel] [PATCH manager 2/2] ui: user view: add 'Unlock TFA' button Wolfgang Bumiller
2023-06-07 16:08   ` [pve-devel] applied: " Thomas Lamprecht
2023-06-07 16:08 ` [pve-devel] applied: [PATCH manager 1/2] ui: user view: show tfa lock status Thomas Lamprecht

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