mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-01 03:03:10 -06:00
Fix test again
This commit is contained in:
parent
6ff9b7ddce
commit
0b2bc83d82
|
|
@ -157,21 +157,24 @@ func getPassword(password, pwdFile string, pwdStdin bool, r io.Reader) (string,
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no parameter was set, ask the user to provide the password
|
// If no parameter was set, ask the user to provide the password
|
||||||
fmt.Print("Enter Password: ")
|
if password == "" {
|
||||||
bytePassword, err := term.ReadPassword(int(os.Stdin.Fd()))
|
fmt.Print("Enter Password: ")
|
||||||
if err != nil {
|
bytePassword, err := term.ReadPassword(int(os.Stdin.Fd()))
|
||||||
return "", fmt.Errorf("Unable to read password: %v", err)
|
if err != nil {
|
||||||
|
return "", fmt.Errorf("Unable to read password: %v", err)
|
||||||
|
}
|
||||||
|
fmt.Println()
|
||||||
|
fmt.Print("Confirm Password: ")
|
||||||
|
bytePassword2, err := term.ReadPassword(int(os.Stdin.Fd()))
|
||||||
|
if err != nil {
|
||||||
|
return "", fmt.Errorf("Unable to read password: %v", err)
|
||||||
|
}
|
||||||
|
fmt.Println()
|
||||||
|
if strings.TrimSpace(string(bytePassword)) != strings.TrimSpace(string(bytePassword2)) {
|
||||||
|
return "", fmt.Errorf("Entered passwords don't match")
|
||||||
|
}
|
||||||
|
return strings.TrimSpace(string(bytePassword)), nil
|
||||||
}
|
}
|
||||||
fmt.Println()
|
|
||||||
fmt.Print("Confirm Password: ")
|
|
||||||
bytePassword2, err := term.ReadPassword(int(os.Stdin.Fd()))
|
|
||||||
if err != nil {
|
|
||||||
return "", fmt.Errorf("Unable to read password: %v", err)
|
|
||||||
}
|
|
||||||
fmt.Println()
|
|
||||||
if strings.TrimSpace(string(bytePassword)) != strings.TrimSpace(string(bytePassword2)) {
|
|
||||||
return "", fmt.Errorf("Entered passwords don't match")
|
|
||||||
}
|
|
||||||
return strings.TrimSpace(string(bytePassword)), nil
|
|
||||||
|
|
||||||
|
return password, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue