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-394: Add warning if using classic ul experience #667

Merged
merged 1 commit into from
Mar 13, 2023
Merged
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
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