From d0ca7e2e3c5ba38dfb498801cc0775a550a030ef Mon Sep 17 00:00:00 2001 From: Rita Zerrizuela Date: Fri, 2 Jul 2021 22:29:42 -0300 Subject: [PATCH 1/2] Fix branding update --- internal/cli/branding.go | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/internal/cli/branding.go b/internal/cli/branding.go index 9c0e22670..088e08be0 100644 --- a/internal/cli/branding.go +++ b/internal/cli/branding.go @@ -114,7 +114,6 @@ func emailTemplateCmd(cli *cli) *cobra.Command { return cmd } - func showBrandingCmd(cli *cli) *cobra.Command { cmd := &cobra.Command{ Use: "show", @@ -157,8 +156,8 @@ func updateBrandingCmd(cli *cli) *cobra.Command { Short: "Update the custom branding settings for Universal Login", Long: "Update the custom branding settings for Universal Login.", Example: `auth0 branding update -auth0 branding update --accent '#B24592' --background '#F2DDEC' -auth0 branding update -a '#B24592' -b '#F2DDEC --logo 'https://example.com/logo.png`, +auth0 branding update --accent "#FF4F40" --background "#2A2E35" +auth0 branding update -a "#FF4F40" -b "#2A2E35" --logo "https://example.com/logo.png"`, RunE: func(cmd *cobra.Command, args []string) error { var current *management.Branding @@ -182,21 +181,24 @@ auth0 branding update -a '#B24592' -b '#F2DDEC --logo 'https://example.com/logo. // Load updated values into a fresh branding instance b := &management.Branding{} + isAccentColorSet := len(inputs.AccentColor) > 0 + isBackgroundColorSet := len(inputs.BackgroundColor) > 0 + currentHasColors := current.Colors != nil - if b.Colors == nil { + if isAccentColorSet || isBackgroundColorSet || currentHasColors { b.Colors = &management.BrandingColors{} - } - if len(inputs.AccentColor) == 0 { - b.Colors.Primary = current.GetColors().Primary - } else { - b.Colors.Primary = &inputs.AccentColor - } + if isAccentColorSet { + b.Colors.Primary = &inputs.AccentColor + } else if currentHasColors { + b.Colors.Primary = current.Colors.Primary + } - if len(inputs.BackgroundColor) == 0 { - b.Colors.PageBackground = current.GetColors().PageBackground - } else { - b.Colors.PageBackground = &inputs.BackgroundColor + if isBackgroundColorSet { + b.Colors.PageBackground = &inputs.BackgroundColor + } else if currentHasColors { + b.Colors.PageBackground = current.Colors.PageBackground + } } if len(inputs.LogoURL) == 0 { From 397a42c163834e0c1b1965eaabc4b1e8affc8dc3 Mon Sep 17 00:00:00 2001 From: Rita Zerrizuela Date: Tue, 6 Jul 2021 15:20:25 -0300 Subject: [PATCH 2/2] Update docs --- docs/auth0_branding_update.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/auth0_branding_update.md b/docs/auth0_branding_update.md index 0ea985d18..39fbe75d1 100644 --- a/docs/auth0_branding_update.md +++ b/docs/auth0_branding_update.md @@ -17,8 +17,8 @@ auth0 branding update [flags] ``` auth0 branding update -auth0 branding update --accent '#B24592' --background '#F2DDEC' -auth0 branding update -a '#B24592' -b '#F2DDEC --logo 'https://example.com/logo.png +auth0 branding update --accent "#FF4F40" --background "#2A2E35" +auth0 branding update -a "#FF4F40" -b "#2A2E35" --logo "https://example.com/logo.png" ``` ### Options