Skip to content

Commit ae4d53e

Browse files
authored
Merge pull request #1563 from ripienaar/1561
Improve server password UX
2 parents f479ef0 + af9a581 commit ae4d53e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cli/server_mkpasswd_command.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ package cli
1515

1616
import (
1717
"fmt"
18+
1819
"github.com/AlecAivazis/survey/v2"
1920
"github.com/choria-io/fisk"
2021
iu "github.com/nats-io/natscli/internal/util"
@@ -75,12 +76,12 @@ func (c *SrvPasswdCmd) askPassword() (string, error) {
7576
bp1 := ""
7677
bp2 := ""
7778

78-
err := iu.AskOne(&survey.Password{Message: "Enter password", Help: "Enter a password string that's minimum 22 characters long"}, &bp1)
79+
err := iu.AskOne(&survey.Password{Message: "Enter password"}, &bp1, survey.WithValidator(survey.MinLength(10)))
7980
if err != nil {
8081
return "", fmt.Errorf("could not read password: %w", err)
8182
}
8283
fmt.Println()
83-
err = iu.AskOne(&survey.Password{Message: "Re-enter password", Help: "Enter the same password again"}, &bp2)
84+
err = iu.AskOne(&survey.Password{Message: "Re-enter password"}, &bp2, survey.WithValidator(survey.MinLength(10)))
8485
if err != nil {
8586
return "", fmt.Errorf("could not read password: %w", err)
8687
}

0 commit comments

Comments
 (0)