public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: Re: [pve-devel] [PATCH v2 widget-toolkit] tfa: improve UX for recovery keys and when none are left
Date: Wed, 17 May 2023 15:22:14 +0200	[thread overview]
Message-ID: <4eev32dw7t4qze64mygtsdwraow4sozurj45corl4scnbw7t5b@excv4sxqczvc> (raw)
In-Reply-To: <20230517115928.235012-1-w.bumiller@proxmox.com>

On Wed, May 17, 2023 at 01:59:28PM +0200, Wolfgang Bumiller wrote:
> If we get an empty challenge, tell the user to contact an
> administrator as it means no 2nd factors and no recovery
> keys are available.
> 
> Currently if only 1 key was available and it had a high ID,
> we'd show something like: "Recovery keys available: 9,
> Warning, less than 4 keys available."
> Let's start off with the warning, and then be explicit about
> the IDs.
> 
> Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
> ---
> Changes to v1 address Dominik's remarks:
>   - Fix typos
>   - Make generated ID list format string right-to-left compatible
>   - Replace the pair of `hasAny2nd` and `hasNonRecovery2nd` with a
>     counter and a `hasRecovery` boolean which allows expressing the
>     condition that "either no 2nd factors, or only an already used up set of
>     recovery keys exists" with less cognitive overhead.
> 
>  src/window/TfaWindow.js | 74 ++++++++++++++++++++++++++++++++---------
>  1 file changed, 58 insertions(+), 16 deletions(-)
> 
> diff --git a/src/window/TfaWindow.js b/src/window/TfaWindow.js
> index 22ac50d..a622ce1 100644
> --- a/src/window/TfaWindow.js
> +++ b/src/window/TfaWindow.js
> @@ -45,11 +45,17 @@ Ext.define('Proxmox.window.TfaLoginWindow', {
>  
>  	    let lastTabId = me.getLastTabUsed();
>  	    let initialTab = -1, i = 0;
> +	    let count2nd = 0;
> +	    let hasRecovery = false;
>  	    for (const k of ['webauthn', 'totp', 'recovery', 'u2f', 'yubico']) {
>  		const available = !!challenge[k];
>  		vm.set(`availableChallenge.${k}`, available);
>  
>  		if (available) {
> +		    count2nd++;
> +		    if (k !== 'recovery') {

^ Dominik noted that is a typo btw., needs to be `===`.




  reply	other threads:[~2023-05-17 13:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-17 11:59 Wolfgang Bumiller
2023-05-17 13:22 ` Wolfgang Bumiller [this message]
2023-05-25  7:28 ` Dominik Csapak

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=4eev32dw7t4qze64mygtsdwraow4sozurj45corl4scnbw7t5b@excv4sxqczvc \
    --to=w.bumiller@proxmox.com \
    --cc=pve-devel@lists.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