From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 2D5906945F for ; Mon, 18 Jan 2021 12:46:50 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 2B88E125C1 for ; Mon, 18 Jan 2021 12:46:50 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id D4128125AD for ; Mon, 18 Jan 2021 12:46:48 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 9B66F46036 for ; Mon, 18 Jan 2021 12:46:48 +0100 (CET) From: Wolfgang Bumiller To: pbs-devel@lists.proxmox.com Date: Mon, 18 Jan 2021 12:46:47 +0100 Message-Id: <20210118114647.632-2-w.bumiller@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210118114647.632-1-w.bumiller@proxmox.com> References: <20210118114647.632-1-w.bumiller@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.049 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] [PATCH backup 2/2] gui: enumerate recovery keys and list in 2nd factor window X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2021 11:46:50 -0000 Signed-off-by: Wolfgang Bumiller --- www/LoginView.js | 20 +++++++++++++++++--- www/window/AddTfaRecovery.js | 7 ++++++- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/www/LoginView.js b/www/LoginView.js index fa8772b5..2dd84de9 100644 --- a/www/LoginView.js +++ b/www/LoginView.js @@ -281,9 +281,9 @@ Ext.define('PBS.login.TfaWindow', { me.lookup('totpButton').setVisible(false); } - if (!view.challenge.recovery) { + if (!view.challenge.recovery || !view.challenge.recovery.length) { me.lookup('recoveryButton').setVisible(false); - } else if (view.challenge.recovery === "low") { + } else if (view.challenge.recovery.length <= 3) { me.lookup('recoveryButton') .setIconCls('fa fa-fw fa-exclamation-triangle'); } @@ -384,7 +384,12 @@ Ext.define('PBS.login.TfaWindow', { me.lookup('webauthnButton').setVisible(false); me.lookup('recoveryButton').setText(gettext("Confirm")); me.lookup('recoveryInfo').setVisible(true); - if (view.challenge.recovery === "low") { + console.log("RECOVERY:", view.challenge.recovery); + me.lookup('availableRecovery').update(Ext.String.htmlEncode( + gettext('Available recovery keys: ') + view.challenge.recovery.join(', ') + )); + me.lookup('availableRecovery').setVisible(true); + if (view.challenge.recovery.length <= 3) { me.lookup('recoveryLow').setVisible(true); } } @@ -456,6 +461,15 @@ Ext.define('PBS.login.TfaWindow', { textAlign: "center", }, }, + { + xtype: 'box', + padding: '0 5', + reference: 'availableRecovery', + hidden: true, + style: { + textAlign: "center", + }, + }, { xtype: 'box', padding: '0 5', diff --git a/www/window/AddTfaRecovery.js b/www/window/AddTfaRecovery.js index b63e8576..1718f026 100644 --- a/www/window/AddTfaRecovery.js +++ b/www/window/AddTfaRecovery.js @@ -24,7 +24,12 @@ Ext.define('PBS.window.AddTfaRecovery', { return; } - let values = response.result.data.recovery.join("\n"); + let values = response + .result + .data + .recovery + .map((v, i) => `${i}: ${v}`) + .join("\n"); Ext.create('PBS.window.TfaRecoveryShow', { autoShow: true, userid: this.getViewModel().get('userid'), -- 2.20.1