Skip to content

Commit

Permalink
DXCDT-394: Add warning if using classic ul experience (#667)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiught authored Mar 13, 2023
1 parent dca152f commit f7c9679
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions internal/cli/universal_login_templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ type TemplateData struct {
LogoURL string
TenantName string
Body string
Experience string
}

// ClientData is a minimal representation of an Auth0 Client as defined in the
Expand Down Expand Up @@ -148,6 +149,14 @@ func updateBrandingTemplateCmd(cli *cli) *cobra.Command {
return fmt.Errorf("failed to fetch the Universal Login template data: %w", err)
}

if templateData.Experience == "classic" {
cli.renderer.Warnf(
"The tenant is configured to use the classic Universal Login Experience instead of the new. " +
"The template changes won't apply until you select the new Universal Login Experience. " +
"You can do so by running: \"auth0 api patch prompts --data '{\"universal_login_experience\":\"new\"}'\"",
)
}

if templateData.Body == "" {
if err := templateBody.Select(cmd, &templateData.Body, templateOptions.labels(), nil); err != nil {
return fmt.Errorf("failed to select the desired template: %w", err)
Expand Down Expand Up @@ -197,6 +206,12 @@ func (cli *cli) fetchTemplateData(ctx context.Context) (*TemplateData, error) {
return ensureCustomDomainIsEnabled(ctx, cli.api)
})

var promptSettings *management.Prompt
group.Go(func() (err error) {
promptSettings, err = cli.api.Prompt.Read()
return err
})

var clientList *management.ClientList
group.Go(func() (err error) {
// Capping the clients retrieved to 100 for now.
Expand Down Expand Up @@ -232,6 +247,7 @@ func (cli *cli) fetchTemplateData(ctx context.Context) (*TemplateData, error) {
LogoURL: brandingSettings.GetLogoURL(),
TenantName: tenant.GetFriendlyName(),
Body: currentTemplate.GetBody(),
Experience: promptSettings.UniversalLoginExperience,
}

for _, client := range clientList.Clients {
Expand Down

0 comments on commit f7c9679

Please sign in to comment.