Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DXCDT-400: Allowing piped-in templates into auth0 ul templates update #950

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/auth0_universal-login_templates_update.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<html>{%- auth0:head -%}{%- auth0:widget -%}</html>" | auth0 ul templates update
```


Expand Down
10 changes: 9 additions & 1 deletion internal/cli/universal_login_templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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 "<html>{%- auth0:head -%}{%- auth0:widget -%}</html>" | auth0 ul templates update`,
RunE: func(cmd *cobra.Command, args []string) error {
ctx := cmd.Context()

Expand All @@ -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)
}
Expand Down
Loading