MCPcopy Create free account
hub / github.com/Scalingo/cli / askForPassword

Function askForPassword

db/users/utils.go:73–89  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

71}
72
73func askForPassword(ctx context.Context) (string, string, error) {
74 fmt.Printf("Password (Will be generated if left empty): ")
75
76 password, err := term.ReadPassword(int(os.Stdin.Fd()))
77 if err != nil {
78 return "", "", errors.Wrap(ctx, err, "read password")
79 }
80
81 fmt.Printf("\nPassword Confirmation: ")
82 confirmedPassword, err := term.ReadPassword(int(os.Stdin.Fd()))
83 if err != nil {
84 return "", "", errors.Wrap(ctx, err, "read password confirmation")
85 }
86 fmt.Println()
87
88 return string(password), string(confirmedPassword), nil
89}
90
91func isPasswordValid(password, confirmedPassword string) (string, bool) {
92 if password == "" && confirmedPassword == "" {

Callers 1

askForPasswordWithRetryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected