public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Lukas Wagner <l.wagner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Cc: Wolfgang Bumiller <w.bumiller@proxmox.com>
Subject: [pbs-devel] [PATCH proxmox-backup 1/2] ui: add missing unlockTfa handler
Date: Tue, 27 Jun 2023 12:04:51 +0200	[thread overview]
Message-ID: <20230627100452.328303-1-l.wagner@proxmox.com> (raw)

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





             reply	other threads:[~2023-06-27 10:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-27 10:04 Lukas Wagner [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230627100452.328303-1-l.wagner@proxmox.com \
    --to=l.wagner@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    --cc=w.bumiller@proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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