[pbs-devel] [PATCH proxmox-backup 1/2] ui: add missing unlockTfa handler

Lukas Wagner l.wagner at proxmox.com
Tue Jun 27 12:04:51 CEST 2023


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

Signed-off-by: Wolfgang Bumiller <w.bumiller at 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






More information about the pbs-devel mailing list