feat: add attribute to only enable specific themes (#6798)

* feat: enable only specific themes in label policy

* feat: enable only specific themes in label policy

* feat: enable only specific themes in label policy

* feat: enable only specific themes in label policy

* add management in console

* pass enabledTheme

* render login ui based on enabled theme

* add in branding / settings service and name consistently

* update console to latest proto state

* fix console linting

* fix linting

* cleanup

* add translations

---------

Co-authored-by: Livio Spring <livio.a@gmail.com>
Co-authored-by: Tim Möhlmann <tim+github@zitadel.com>
This commit is contained in:
Stefan Benz
2023-10-26 07:54:09 +02:00
committed by GitHub
parent 7b0506c19c
commit cb7b50b513
43 changed files with 527 additions and 100 deletions

View File

@@ -75,6 +75,7 @@ func TestCommandSide_AddLabelPolicy(t *testing.T) {
true,
true,
true,
domain.LabelPolicyThemeAuto,
),
),
),
@@ -121,6 +122,7 @@ func TestCommandSide_AddLabelPolicy(t *testing.T) {
true,
true,
true,
domain.LabelPolicyThemeDark,
),
),
),
@@ -140,6 +142,7 @@ func TestCommandSide_AddLabelPolicy(t *testing.T) {
HideLoginNameSuffix: true,
ErrorMsgPopup: true,
DisableWatermark: true,
ThemeMode: domain.LabelPolicyThemeDark,
},
},
res: res{
@@ -159,6 +162,7 @@ func TestCommandSide_AddLabelPolicy(t *testing.T) {
HideLoginNameSuffix: true,
ErrorMsgPopup: true,
DisableWatermark: true,
ThemeMode: domain.LabelPolicyThemeDark,
},
},
},
@@ -260,6 +264,7 @@ func TestCommandSide_ChangeLabelPolicy(t *testing.T) {
true,
true,
true,
domain.LabelPolicyThemeAuto,
),
),
),
@@ -280,6 +285,7 @@ func TestCommandSide_ChangeLabelPolicy(t *testing.T) {
HideLoginNameSuffix: true,
ErrorMsgPopup: true,
DisableWatermark: true,
ThemeMode: domain.LabelPolicyThemeAuto,
},
},
res: res{
@@ -306,6 +312,7 @@ func TestCommandSide_ChangeLabelPolicy(t *testing.T) {
true,
true,
true,
domain.LabelPolicyThemeAuto,
),
),
),
@@ -323,7 +330,8 @@ func TestCommandSide_ChangeLabelPolicy(t *testing.T) {
"#000000",
false,
false,
false),
false,
domain.LabelPolicyThemeDark),
),
),
},
@@ -342,6 +350,7 @@ func TestCommandSide_ChangeLabelPolicy(t *testing.T) {
HideLoginNameSuffix: false,
ErrorMsgPopup: false,
DisableWatermark: false,
ThemeMode: domain.LabelPolicyThemeDark,
},
},
res: res{
@@ -361,6 +370,7 @@ func TestCommandSide_ChangeLabelPolicy(t *testing.T) {
HideLoginNameSuffix: false,
ErrorMsgPopup: false,
DisableWatermark: false,
ThemeMode: domain.LabelPolicyThemeDark,
},
},
},
@@ -451,6 +461,7 @@ func TestCommandSide_ActivateLabelPolicy(t *testing.T) {
true,
true,
true,
domain.LabelPolicyThemeAuto,
),
),
),
@@ -551,6 +562,7 @@ func TestCommandSide_RemoveLabelPolicy(t *testing.T) {
true,
true,
true,
domain.LabelPolicyThemeAuto,
),
),
),
@@ -672,6 +684,7 @@ func TestCommandSide_AddLogoLabelPolicy(t *testing.T) {
true,
true,
true,
domain.LabelPolicyThemeAuto,
),
),
),
@@ -714,6 +727,7 @@ func TestCommandSide_AddLogoLabelPolicy(t *testing.T) {
true,
true,
true,
domain.LabelPolicyThemeAuto,
),
),
),
@@ -838,6 +852,7 @@ func TestCommandSide_RemoveLogoLabelPolicy(t *testing.T) {
true,
true,
true,
domain.LabelPolicyThemeAuto,
),
),
eventFromEventPusher(
@@ -974,6 +989,7 @@ func TestCommandSide_AddIconLabelPolicy(t *testing.T) {
true,
true,
true,
domain.LabelPolicyThemeAuto,
),
),
),
@@ -1016,6 +1032,7 @@ func TestCommandSide_AddIconLabelPolicy(t *testing.T) {
true,
true,
true,
domain.LabelPolicyThemeAuto,
),
),
),
@@ -1138,6 +1155,7 @@ func TestCommandSide_RemoveIconLabelPolicy(t *testing.T) {
true,
true,
true,
domain.LabelPolicyThemeAuto,
),
),
eventFromEventPusher(
@@ -1273,6 +1291,7 @@ func TestCommandSide_AddLogoDarkLabelPolicy(t *testing.T) {
true,
true,
true,
domain.LabelPolicyThemeAuto,
),
),
),
@@ -1315,6 +1334,7 @@ func TestCommandSide_AddLogoDarkLabelPolicy(t *testing.T) {
true,
true,
true,
domain.LabelPolicyThemeAuto,
),
),
),
@@ -1439,6 +1459,7 @@ func TestCommandSide_RemoveLogoDarkLabelPolicy(t *testing.T) {
true,
true,
true,
domain.LabelPolicyThemeAuto,
),
),
eventFromEventPusher(
@@ -1575,6 +1596,7 @@ func TestCommandSide_AddIconDarkLabelPolicy(t *testing.T) {
true,
true,
true,
domain.LabelPolicyThemeAuto,
),
),
),
@@ -1617,6 +1639,7 @@ func TestCommandSide_AddIconDarkLabelPolicy(t *testing.T) {
true,
true,
true,
domain.LabelPolicyThemeAuto,
),
),
),
@@ -1737,6 +1760,7 @@ func TestCommandSide_RemoveIconDarkLabelPolicy(t *testing.T) {
true,
true,
true,
domain.LabelPolicyThemeAuto,
),
),
eventFromEventPusher(
@@ -1864,6 +1888,7 @@ func TestCommandSide_AddFontLabelPolicy(t *testing.T) {
true,
true,
true,
domain.LabelPolicyThemeAuto,
),
),
),
@@ -1906,6 +1931,7 @@ func TestCommandSide_AddFontLabelPolicy(t *testing.T) {
true,
true,
true,
domain.LabelPolicyThemeAuto,
),
),
),
@@ -2026,6 +2052,7 @@ func TestCommandSide_RemoveFontLabelPolicy(t *testing.T) {
true,
true,
true,
domain.LabelPolicyThemeAuto,
),
),
eventFromEventPusher(
@@ -2074,7 +2101,7 @@ func TestCommandSide_RemoveFontLabelPolicy(t *testing.T) {
}
}
func newLabelPolicyChangedEvent(ctx context.Context, orgID, primaryColor, backgroundColor, warnColor, fontColor, primaryColorDark, backgroundColorDark, warnColorDark, fontColorDark string, hideLoginNameSuffix, errMsgPopup, disableWatermark bool) *org.LabelPolicyChangedEvent {
func newLabelPolicyChangedEvent(ctx context.Context, orgID, primaryColor, backgroundColor, warnColor, fontColor, primaryColorDark, backgroundColorDark, warnColorDark, fontColorDark string, hideLoginNameSuffix, errMsgPopup, disableWatermark bool, theme domain.LabelPolicyThemeMode) *org.LabelPolicyChangedEvent {
event, _ := org.NewLabelPolicyChangedEvent(ctx,
&org.NewAggregate(orgID).Aggregate,
[]policy.LabelPolicyChanges{
@@ -2089,6 +2116,7 @@ func newLabelPolicyChangedEvent(ctx context.Context, orgID, primaryColor, backgr
policy.ChangeHideLoginNameSuffix(hideLoginNameSuffix),
policy.ChangeErrorMsgPopup(errMsgPopup),
policy.ChangeDisableWatermark(disableWatermark),
policy.ChangeThemeMode(theme),
},
)
return event