Fix cli output to stdout on user creation

This commit is contained in:
Peter Grlica
2021-11-02 18:40:51 +01:00
committed by Denis Arh
parent 402006bebb
commit 680f4db003
+4 -4
View File
@@ -138,17 +138,17 @@ func Users(ctx context.Context, app serviceInitializer) *cobra.Command {
}
// generate the create password link of user
if !flagNoPassword && len(password) == 0 && flagMakePasswordLink {
if flagNoPassword && len(password) == 0 && flagMakePasswordLink {
url, err = authSvc.GeneratePasswordCreateToken(ctx, user.Email)
if err != nil {
cli.HandleError(err)
}
}
cmd.Printf("User created [%d].\n", user.ID)
fmt.Fprintf(cmd.OutOrStdout(), "User created [%d].\n", user.ID)
if flagMakePasswordLink && len(url) > 0 {
cmd.Println("Set password by clicking here:")
cmd.Printf("%s\n", url)
fmt.Fprintf(cmd.OutOrStdout(), "Set password by clicking here:\n%s\n", url)
}
if len(mm) > 0 {