Skip to content

Commit

Permalink
Merge pull request digitalocean#428 from waynr/disable-terminal-echo-…
Browse files Browse the repository at this point in the history
…during-auth-token-prompt

Disable terminal ECHO flag when prompting for auth token
  • Loading branch information
hilary authored Apr 25, 2019
2 parents fbd1643 + cc09a51 commit c15aeeb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions commands/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ limitations under the License.
package commands

import (
"bufio"
"errors"
"fmt"
"os"
Expand All @@ -37,9 +36,13 @@ func retrieveUserTokenFromCommandLine() (string, error) {
return "", ErrUnknownTerminal
}

reader := bufio.NewReader(os.Stdin)
fmt.Print("DigitalOcean access token: ")
return reader.ReadString('\n')
passwdBytes, err := terminal.ReadPassword(0)
if err != nil {
return "", err
}

return string(passwdBytes), nil
}

// UnknownSchemeError signifies an unknown HTTP scheme.
Expand Down

0 comments on commit c15aeeb

Please sign in to comment.