MCPcopy Create free account
hub / github.com/auth0/auth0-cli / updateUniversalLoginCmd

Function updateUniversalLoginCmd

internal/cli/universal_login.go:146–243  ·  view source on GitHub ↗
(cli *cli)

Source from the content-addressed store, hash-verified

144}
145
146func updateUniversalLoginCmd(cli *cli) *cobra.Command {
147 var inputs struct {
148 AccentColor string
149 BackgroundColor string
150 LogoURL string
151 FaviconURL string
152 CustomFontURL string
153 }
154
155 cmd := &cobra.Command{
156 Use: "update",
157 Args: cobra.NoArgs,
158 Short: "Update the custom branding settings for Universal Login",
159 Long: "Update the custom branding settings for Universal Login.\n\n" +
160 "To update the settings for Universal Login interactively, use `auth0 universal-login update` " +
161 "with no arguments.\n\n" +
162 "To update the settings for Universal Login non-interactively, supply the accent, background and " +
163 "logo through the flags.",
164 Example: ` auth0 universal-login update
165 auth0 ul update --accent "#FF4F40" --background "#2A2E35" --logo "https://example.com/logo.png"
166 auth0 ul update -a "#FF4F40" -b "#2A2E35" -l "https://example.com/logo.png"
167 auth0 ul update -a "#FF4F40" -b "#2A2E35" -l "https://example.com/logo.png" --json
168 auth0 ul update -a "#FF4F40" -b "#2A2E35" -l "https://example.com/logo.png" --json-compact`,
169 RunE: func(cmd *cobra.Command, args []string) error {
170 var current *management.Branding
171
172 if err := ansi.Waiting(func() (err error) {
173 current, err = cli.api.Branding.Read(cmd.Context())
174 return err
175 }); err != nil {
176 return fmt.Errorf("failed to read branding settings: %w", err)
177 }
178
179 if err := brandingAccent.AskU(cmd, &inputs.AccentColor, auth0.String(current.GetColors().GetPrimary())); err != nil {
180 return err
181 }
182
183 if err := brandingBackground.AskU(cmd, &inputs.BackgroundColor, auth0.String(current.GetColors().GetPageBackground())); err != nil {
184 return err
185 }
186
187 b := &management.Branding{}
188 isAccentColorSet := len(inputs.AccentColor) > 0
189 isBackgroundColorSet := len(inputs.BackgroundColor) > 0
190 currentHasColors := current.GetColors() != nil
191
192 if isAccentColorSet || isBackgroundColorSet || currentHasColors {
193 b.Colors = &management.BrandingColors{}
194
195 if isAccentColorSet {
196 b.Colors.Primary = &inputs.AccentColor
197 } else if currentHasColors {
198 b.Colors.Primary = current.Colors.Primary
199 }
200
201 if isBackgroundColorSet {
202 b.Colors.PageBackground = &inputs.BackgroundColor
203 } else if currentHasColors {

Callers 1

universalLoginCmdFunction · 0.85

Calls 7

WaitingFunction · 0.92
ErrorfMethod · 0.80
AskUMethod · 0.80
BrandingUpdateMethod · 0.80
RegisterStringUMethod · 0.80
ReadMethod · 0.65
UpdateMethod · 0.65

Tested by

no test coverage detected