diff --git a/docs/auth0_universal-login_templates_update.md b/docs/auth0_universal-login_templates_update.md index 0aaa80300..d015d88ad 100644 --- a/docs/auth0_universal-login_templates_update.md +++ b/docs/auth0_universal-login_templates_update.md @@ -17,6 +17,8 @@ auth0 universal-login templates update [flags] ``` auth0 universal-login templates update auth0 ul templates update + cat login.liquid | auth0 ul templates update + echo "{%- auth0:head -%}{%- auth0:widget -%}" | auth0 ul templates update ``` diff --git a/internal/cli/universal_login_templates.go b/internal/cli/universal_login_templates.go index 816f44ca2..994c1b1bd 100644 --- a/internal/cli/universal_login_templates.go +++ b/internal/cli/universal_login_templates.go @@ -22,6 +22,7 @@ import ( "github.com/auth0/auth0-cli/internal/ansi" "github.com/auth0/auth0-cli/internal/auth0" + "github.com/auth0/auth0-cli/internal/iostream" "github.com/auth0/auth0-cli/internal/prompt" ) @@ -136,7 +137,9 @@ func updateBrandingTemplateCmd(cli *cli) *cobra.Command { Short: "Update the custom template for Universal Login", Long: "Update the custom template for the New Universal Login Experience.", Example: ` auth0 universal-login templates update - auth0 ul templates update`, + auth0 ul templates update + cat login.liquid | auth0 ul templates update + echo "{%- auth0:head -%}{%- auth0:widget -%}" | auth0 ul templates update`, RunE: func(cmd *cobra.Command, args []string) error { ctx := cmd.Context() @@ -161,6 +164,11 @@ func updateBrandingTemplateCmd(cli *cli) *cobra.Command { templateData.Body = templateOptions.getValue(templateData.Body) } + pipedTemplateHTML := iostream.PipedInput() + if len(pipedTemplateHTML) > 0 { + templateData.Body = string(pipedTemplateHTML) + } + if err := cli.editTemplateAndPreviewChanges(ctx, cmd, templateData); err != nil { return fmt.Errorf("failed to edit the template and preview the changes: %w", err) }