Prompt for password input

This commit is contained in:
Mariano Uvalle 2023-11-10 16:42:47 +00:00
parent 7bd75ada56
commit 4bfaf12de7

View file

@ -9,6 +9,7 @@ import (
// ReadPassword reads a single line of text from the terminal withouth echoing it out. // ReadPassword reads a single line of text from the terminal withouth echoing it out.
func ReadPassword() string { func ReadPassword() string {
fmt.Println("Enter your password:")
raw, err := term.ReadPassword(int(os.Stdin.Fd())) raw, err := term.ReadPassword(int(os.Stdin.Fd()))
if err != nil { if err != nil {
panic(fmt.Sprintf("could not reat password from the terminal: %s", err.Error())) panic(fmt.Sprintf("could not reat password from the terminal: %s", err.Error()))