diff --git a/internal/cli/universal_login.go b/internal/cli/universal_login.go index 1bf1cca23..8c9468820 100644 --- a/internal/cli/universal_login.go +++ b/internal/cli/universal_login.go @@ -178,7 +178,7 @@ func updateUniversalLoginCmd(cli *cli) *cobra.Command { b := &management.Branding{} isAccentColorSet := len(inputs.AccentColor) > 0 isBackgroundColorSet := len(inputs.BackgroundColor) > 0 - currentHasColors := current.Colors != nil + currentHasColors := current.GetColors() != nil if isAccentColorSet || isBackgroundColorSet || currentHasColors { b.Colors = &management.BrandingColors{} @@ -196,15 +196,17 @@ func updateUniversalLoginCmd(cli *cli) *cobra.Command { } } - if len(inputs.LogoURL) == 0 { - b.LogoURL = current.LogoURL - } else { + logoURL := current.GetLogoURL() + if len(inputs.LogoURL) == 0 && logoURL != "" { + b.LogoURL = &logoURL + } else if len(inputs.LogoURL) != 0 { b.LogoURL = &inputs.LogoURL } - if len(inputs.FaviconURL) == 0 { - b.FaviconURL = current.FaviconURL - } else { + favIconURL := current.GetFaviconURL() + if len(inputs.FaviconURL) == 0 && favIconURL != "" { + b.FaviconURL = &favIconURL + } else if len(inputs.FaviconURL) != 0 { b.FaviconURL = &inputs.FaviconURL } @@ -213,14 +215,6 @@ func updateUniversalLoginCmd(cli *cli) *cobra.Command { b.Font = &management.BrandingFont{URL: &inputs.CustomFontURL} } - if b.Font != nil { - if len(inputs.CustomFontURL) == 0 { - b.Font.URL = current.Font.URL - } else { - b.Font.URL = &inputs.CustomFontURL - } - } - // Update branding if err := ansi.Waiting(func() error { return cli.api.Branding.Update(b) diff --git a/test/integration/universal-login-test-cases.yaml b/test/integration/universal-login-test-cases.yaml index 3da3fa759..5b96e2bfb 100644 --- a/test/integration/universal-login-test-cases.yaml +++ b/test/integration/universal-login-test-cases.yaml @@ -70,4 +70,4 @@ tests: colors.page_background: "#FF4F40" favicon_url: "https://example.com/favicon-updated-2.png" logo_url: "https://example.com/logo-updated-2.png" - font.url: "https://example.com/font-updated-2.woff" \ No newline at end of file + font.url: "https://example.com/font-updated-2.woff"