Repository: codenotary/immudb
File: cmd/immuclient/immuc/login.go (Go)

Code before:
	var oldpass []byte
	var err error
	if username == auth.SysAdminUsername {
		oldpass, err = i.passwordReader.Read("Old password:")
		if err != nil {
			return "Error Reading Password", nil
		}
	}
	newpass, err := i.passwordReader.Read(fmt.Sprintf("Choose a password for %s:", username))
	if err != nil {
		return "Error Reading Password", nil
	}
	if err = auth.IsStrongPassword(string(newpass)); err != nil {
		return "password does not meet the requirements. It must contain upper and lower case letters, digits, punctuation mark or symbol", nil
	}
	pass2, err := i.passwordReader.Read("Confirm password:")
	if err != nil {
		return "Error Reading Password", nil
	}
	if !bytes.Equal(newpass, pass2) {
		return "Passwords don't match", nil
	}
	if err := i.ImmuClient.ChangePassword(context.Background(), []byte(username), oldpass, []byte(newpass)); err != nil {
		return "", err
	}
	return fmt.Sprintf("Password of %s was changed successfully", username), nil
}
func (i *immuc) SetActiveUser(args []string, active bool) (string, error) {
	if len(args) < 1 {
		return "incorrect number of parameters for this command. Please type 'user help' for more information", nil
	}
	username := args[0]
	err := i.ImmuClient.SetActiveUser(context.Background(), &schema.SetActiveUserRequest{
		Active:   active,
		Username: username,
	})
	if err != nil {
		return "", err
	}
	return "user status changed successfully", nil
}

func (i *immuc) SetUserPermission(args []string) (string, error) {
	if len(args) != 4 {
		return "incorrect number of parameters for this command. Please type 'user help' for more information", nil
	}
	var permissionAction schema.PermissionAction
	switch args[0] {
	case "grant":
		permissionAction = schema.PermissionAction_GRANT
	case "revoke":

Review comment (suggestion):
hi @muesli, probably "Password of %s was successfully changed" it's better. If so, could you please change it and we can merge your PR. Thanks a lot

Code after:
	var oldpass []byte
	var err error
	if username == auth.SysAdminUsername {
		oldpass, err = i.passwordReader.Read("Old password:")
		if err != nil {
			return "Error Reading Password", nil
		}
	}
	newpass, err := i.passwordReader.Read(fmt.Sprintf("Choose a password for %s:", username))
	if err != nil {
		return "Error Reading Password", nil
	}
	if err = auth.IsStrongPassword(string(newpass)); err != nil {
		return "password does not meet the requirements. It must contain upper and lower case letters, digits, punctuation mark or symbol", nil
	}
	pass2, err := i.passwordReader.Read("Confirm password:")
	if err != nil {
		return "Error Reading Password", nil
	}
	if !bytes.Equal(newpass, pass2) {
		return "Passwords don't match", nil
	}
	if err := i.ImmuClient.ChangePassword(context.Background(), []byte(username), oldpass, []byte(newpass)); err != nil {
		return "", err
	}
	return fmt.Sprintf("Password of %s was successfully changed", username), nil
}
func (i *immuc) SetActiveUser(args []string, active bool) (string, error) {
	if len(args) < 1 {
		return "incorrect number of parameters for this command. Please type 'user help' for more information", nil
	}
	username := args[0]
	err := i.ImmuClient.SetActiveUser(context.Background(), &schema.SetActiveUserRequest{
		Active:   active,
		Username: username,
	})
	if err != nil {
		return "", err
	}
	return "user status changed successfully", nil
}

func (i *immuc) SetUserPermission(args []string) (string, error) {
	if len(args) != 4 {
		return "incorrect number of parameters for this command. Please type 'user help' for more information", nil
	}
	var permissionAction schema.PermissionAction
	switch args[0] {
	case "grant":
		permissionAction = schema.PermissionAction_GRANT
	case "revoke":