mirror of
https://github.com/passbolt/go-passbolt-cli.git
synced 2025-05-12 02:58:20 +00:00
use string instead of []byte
This commit is contained in:
parent
fe7e6b2a22
commit
6d5327cd95
1 changed files with 4 additions and 4 deletions
|
@ -19,7 +19,7 @@ import (
|
||||||
// ReadPassword reads a Password interactively or via Pipe
|
// ReadPassword reads a Password interactively or via Pipe
|
||||||
func ReadPassword() (string, error) {
|
func ReadPassword() (string, error) {
|
||||||
fd := int(os.Stdin.Fd())
|
fd := int(os.Stdin.Fd())
|
||||||
var pass []byte
|
var pass string
|
||||||
if term.IsTerminal(fd) {
|
if term.IsTerminal(fd) {
|
||||||
fmt.Print("Enter Password:")
|
fmt.Print("Enter Password:")
|
||||||
|
|
||||||
|
@ -27,17 +27,17 @@ func ReadPassword() (string, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
pass = inputPass
|
pass = string(inputPass)
|
||||||
} else {
|
} else {
|
||||||
reader := bufio.NewReader(os.Stdin)
|
reader := bufio.NewReader(os.Stdin)
|
||||||
s, err := reader.ReadString('\n')
|
s, err := reader.ReadString('\n')
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
pass = []byte(s)
|
pass = s
|
||||||
}
|
}
|
||||||
|
|
||||||
return strings.Replace(string(pass), "\n", "", 1), nil
|
return strings.Replace(pass, "\n", "", 1), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetClient gets a Logged in Passbolt Client
|
// GetClient gets a Logged in Passbolt Client
|
||||||
|
|
Loading…
Add table
Reference in a new issue