mirror of
https://github.com/passbolt/go-passbolt-cli.git
synced 2025-05-11 02:28:22 +00:00
Use old TOTP flags if the new ones are unset
This commit is contained in:
parent
1229ad7b59
commit
e0469a14b0
1 changed files with 13 additions and 1 deletions
|
@ -9,6 +9,7 @@ import (
|
|||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/passbolt/go-passbolt/api"
|
||||
"github.com/passbolt/go-passbolt/helper"
|
||||
|
@ -123,7 +124,18 @@ func GetClient(ctx context.Context) (*api.Client, error) {
|
|||
return http.Cookie{}, fmt.Errorf("Failed MFA Challenge 3 times: %w", err)
|
||||
}
|
||||
case "noninteractive-totp":
|
||||
helper.AddMFACallbackTOTP(client, viper.GetUint("mfaRetrys"), viper.GetDuration("mfaDelay"), viper.GetDuration("totpOffset"), viper.GetString("totpToken"))
|
||||
// if new flag is unset, use old flag instead
|
||||
totpToken := viper.GetString("mfaTotpToken")
|
||||
if totpToken == "" {
|
||||
totpToken = viper.GetString("totpToken")
|
||||
}
|
||||
|
||||
totpOffset := viper.GetDuration("mfaTotpOffset")
|
||||
if totpOffset == time.Duration(0) {
|
||||
totpOffset = viper.GetDuration("totpOffset")
|
||||
}
|
||||
|
||||
helper.AddMFACallbackTOTP(client, viper.GetUint("mfaRetrys"), viper.GetDuration("mfaDelay"), totpOffset, totpToken)
|
||||
case "none":
|
||||
default:
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue