]> git.proxmox.com Git - proxmox-backup.git/commitdiff
ui: add missing unlockTfa handler
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Tue, 27 Jun 2023 10:04:51 +0000 (12:04 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 27 Jun 2023 11:30:32 +0000 (13:30 +0200)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Dominik Csapak <d.csapak@proxmox.com>
www/config/UserView.js

index 5a5b2f4eeac039ce21650354f0eb83e357bf1195..9a0a0b2be9584739305a9073d2d0a0bf946f0d9c 100644 (file)
@@ -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: {