mirror of
https://github.com/passbolt/go-passbolt-cli.git
synced 2025-05-12 02:58:20 +00:00
Replace usages of term.ReadPassword with util.ReadPassword
This commit is contained in:
parent
bfbc15bd0d
commit
440f41a2af
3 changed files with 5 additions and 10 deletions
|
@ -2,13 +2,11 @@ package cmd
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"syscall"
|
||||
|
||||
"github.com/passbolt/go-passbolt-cli/util"
|
||||
"github.com/passbolt/go-passbolt/api"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
"golang.org/x/term"
|
||||
)
|
||||
|
||||
// verifyCMD represents the verify command
|
||||
|
@ -35,12 +33,12 @@ var verifyCMD = &cobra.Command{
|
|||
userPassword := viper.GetString("userPassword")
|
||||
if userPassword == "" {
|
||||
fmt.Print("Enter Password:")
|
||||
bytepw, err := term.ReadPassword(int(syscall.Stdin))
|
||||
pw, err := util.ReadPassword()
|
||||
if err != nil {
|
||||
fmt.Println()
|
||||
return fmt.Errorf("Reading Password: %w", err)
|
||||
}
|
||||
userPassword = string(bytepw)
|
||||
userPassword = pw
|
||||
fmt.Println()
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"syscall"
|
||||
|
||||
"github.com/passbolt/go-passbolt-cli/util"
|
||||
"github.com/passbolt/go-passbolt/api"
|
||||
|
@ -13,7 +12,6 @@ import (
|
|||
"github.com/spf13/cobra"
|
||||
"github.com/tobischo/gokeepasslib/v3"
|
||||
w "github.com/tobischo/gokeepasslib/v3/wrappers"
|
||||
"golang.org/x/term"
|
||||
)
|
||||
|
||||
// KeepassExportCmd Exports a Passbolt Keepass
|
||||
|
@ -56,12 +54,12 @@ func KeepassExport(cmd *cobra.Command, args []string) error {
|
|||
|
||||
if keepassPassword == "" {
|
||||
fmt.Print("Enter Keepass Password:")
|
||||
bytepw, err := term.ReadPassword(int(syscall.Stdin))
|
||||
pw, err := util.ReadPassword()
|
||||
if err != nil {
|
||||
fmt.Println()
|
||||
return fmt.Errorf("Reading Keepass Password: %w", err)
|
||||
}
|
||||
keepassPassword = string(bytepw)
|
||||
keepassPassword = pw
|
||||
fmt.Println()
|
||||
}
|
||||
|
||||
|
|
|
@ -97,12 +97,11 @@ func GetClient(ctx context.Context) (*api.Client, error) {
|
|||
for i := 0; i < 3; i++ {
|
||||
var code string
|
||||
fmt.Print("Enter TOTP:")
|
||||
bytepw, err := term.ReadPassword(int(syscall.Stdin))
|
||||
code, err := ReadPassword()
|
||||
if err != nil {
|
||||
fmt.Printf("\n")
|
||||
return http.Cookie{}, fmt.Errorf("Reading TOTP: %w", err)
|
||||
}
|
||||
code = string(bytepw)
|
||||
fmt.Printf("\n")
|
||||
req := api.MFAChallangeResponse{
|
||||
TOTP: code,
|
||||
|
|
Loading…
Add table
Reference in a new issue