Skip to content

Commit 25b0255

Browse files
committed
Fix command for creating new user
1 parent 4a0add0 commit 25b0255

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

cmd/pbcli/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func main() {
3333
Username: cmds.Username,
3434
}
3535

36-
password := ui.GetPassword()
36+
password := ui.GetPassword("Current password of user " + s.Username + ": ")
3737

3838
settings.Runner.Run(s, password)
3939
}

internal/ui/mod.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import (
1010
)
1111

1212
// GetPassword reads a password from the terminal.
13-
func GetPassword() string {
14-
fmt.Print("Password: ")
13+
func GetPassword(prompt string) string {
14+
fmt.Print(prompt)
1515
passwordBytes, err := terminal.ReadPassword(int(syscall.Stdin))
1616
fmt.Print("\n")
1717

internal/user/create.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ func (c *createCommand) Execute(args []string) error {
2525
}
2626

2727
func (c *createCommand) Run(s settings.Settings, password string) {
28+
newPassword := ui.GetPassword("New password of user " + c.Arguments.Name + ": ")
29+
2830
data := map[string]interface{}{
2931
"name": c.Arguments.Name,
32+
"password": newPassword,
3033
"matrix_id": c.Arguments.MatrixID,
3134
}
3235

0 commit comments

Comments
 (0)