fix: change back to login button and add to register option screen (#4847)

* fix: change back to login button and add to register option screen

* fix: change back to login button and add logic for remove and set events

Co-authored-by: Fabi <38692350+hifabienne@users.noreply.github.com>
This commit is contained in:
Stefan Benz
2022-12-20 08:26:48 +00:00
committed by GitHub
parent 5d61ed5cac
commit 339fbd4f0c
14 changed files with 75 additions and 5 deletions

View File

@@ -761,6 +761,10 @@ func (c *Commands) createRegistrationOptionEvents(ctx context.Context, agg *even
if event != nil {
events = append(events, event)
}
event = c.createCustomLoginTextEvent(ctx, agg, domain.LoginKeyRegistrationOptionLoginButtonText, existingText.RegistrationOptionLoginButtonText, text.RegisterOption.LoginButtonText, text.Language, defaultText)
if event != nil {
events = append(events, event)
}
return events
}

View File

@@ -204,6 +204,7 @@ type CustomLoginTextReadModel struct {
RegistrationOptionDescription string
RegistrationOptionUserNameButtonText string
RegistrationOptionExternalLoginDescription string
RegistrationOptionLoginButtonText string
RegistrationUserTitle string
RegistrationUserDescription string
@@ -1878,6 +1879,10 @@ func (wm *CustomLoginTextReadModel) handleRegistrationOptionScreenSetEvent(e *po
wm.RegistrationOptionExternalLoginDescription = e.Text
return
}
if e.Key == domain.LoginKeyRegistrationOptionLoginButtonText {
wm.RegistrationOptionLoginButtonText = e.Text
return
}
}
func (wm *CustomLoginTextReadModel) handleRegistrationOptionScreenRemoveEvent(e *policy.CustomTextRemovedEvent) {
@@ -1897,6 +1902,10 @@ func (wm *CustomLoginTextReadModel) handleRegistrationOptionScreenRemoveEvent(e
wm.RegistrationOptionExternalLoginDescription = ""
return
}
if e.Key == domain.LoginKeyRegistrationOptionLoginButtonText {
wm.RegistrationOptionLoginButtonText = ""
return
}
}
func (wm *CustomLoginTextReadModel) handleRegistrationUserScreenSetEvent(e *policy.CustomTextSetEvent) {

View File

@@ -932,6 +932,12 @@ func TestCommandSide_SetCustomIAMLoginText(t *testing.T) {
&instance.NewAggregate("INSTANCE").Aggregate, domain.LoginCustomText, domain.LoginKeyRegistrationOptionExternalLoginDescription, "ExternalLoginDescription", language.English,
),
),
eventFromEventPusherWithInstanceID(
"INSTANCE",
instance.NewCustomTextSetEvent(context.Background(),
&instance.NewAggregate("INSTANCE").Aggregate, domain.LoginCustomText, domain.LoginKeyRegistrationOptionLoginButtonText, "LoginButtonText", language.English,
),
),
eventFromEventPusherWithInstanceID(
"INSTANCE",
instance.NewCustomTextSetEvent(context.Background(),
@@ -1569,6 +1575,7 @@ func TestCommandSide_SetCustomIAMLoginText(t *testing.T) {
Description: "Description",
RegisterUsernamePasswordButtonText: "RegisterUsernamePasswordButtonText",
ExternalLoginDescription: "ExternalLoginDescription",
LoginButtonText: "LoginButtonText",
},
RegistrationUser: domain.RegistrationUserScreenText{
Title: "Title",
@@ -2548,6 +2555,12 @@ func TestCommandSide_SetCustomIAMLoginText(t *testing.T) {
&instance.NewAggregate("INSTANCE").Aggregate, domain.LoginCustomText, domain.LoginKeyRegistrationOptionExternalLoginDescription, "ExternalLoginDescription", language.English,
),
),
eventFromEventPusherWithInstanceID(
"INSTANCE",
instance.NewCustomTextSetEvent(context.Background(),
&instance.NewAggregate("INSTANCE").Aggregate, domain.LoginCustomText, domain.LoginKeyRegistrationOptionLoginButtonText, "LoginButtonText", language.English,
),
),
eventFromEventPusherWithInstanceID(
"INSTANCE",
instance.NewCustomTextSetEvent(context.Background(),
@@ -3859,6 +3872,12 @@ func TestCommandSide_SetCustomIAMLoginText(t *testing.T) {
&instance.NewAggregate("INSTANCE").Aggregate, domain.LoginCustomText, domain.LoginKeyRegistrationOptionExternalLoginDescription, language.English,
),
),
eventFromEventPusherWithInstanceID(
"INSTANCE",
instance.NewCustomTextRemovedEvent(context.Background(),
&instance.NewAggregate("INSTANCE").Aggregate, domain.LoginCustomText, domain.LoginKeyRegistrationOptionLoginButtonText, language.English,
),
),
eventFromEventPusherWithInstanceID(
"INSTANCE",
instance.NewCustomTextRemovedEvent(context.Background(),
@@ -5223,6 +5242,12 @@ func TestCommandSide_SetCustomIAMLoginText(t *testing.T) {
&instance.NewAggregate("INSTANCE").Aggregate, domain.LoginCustomText, domain.LoginKeyRegistrationOptionExternalLoginDescription, "ExternalLoginDescription", language.English,
),
),
eventFromEventPusherWithInstanceID(
"INSTANCE",
instance.NewCustomTextSetEvent(context.Background(),
&instance.NewAggregate("INSTANCE").Aggregate, domain.LoginCustomText, domain.LoginKeyRegistrationOptionLoginButtonText, "LoginButtonText", language.English,
),
),
eventFromEventPusherWithInstanceID(
"INSTANCE",
instance.NewCustomTextSetEvent(context.Background(),
@@ -6532,6 +6557,12 @@ func TestCommandSide_SetCustomIAMLoginText(t *testing.T) {
&instance.NewAggregate("INSTANCE").Aggregate, domain.LoginCustomText, domain.LoginKeyRegistrationOptionExternalLoginDescription, language.English,
),
),
eventFromEventPusherWithInstanceID(
"INSTANCE",
instance.NewCustomTextRemovedEvent(context.Background(),
&instance.NewAggregate("INSTANCE").Aggregate, domain.LoginCustomText, domain.LoginKeyRegistrationOptionLoginButtonText, language.English,
),
),
eventFromEventPusherWithInstanceID(
"INSTANCE",
instance.NewCustomTextRemovedEvent(context.Background(),
@@ -7844,6 +7875,12 @@ func TestCommandSide_SetCustomIAMLoginText(t *testing.T) {
&instance.NewAggregate("INSTANCE").Aggregate, domain.LoginCustomText, domain.LoginKeyRegistrationOptionExternalLoginDescription, "ExternalLoginDescription", language.English,
),
),
eventFromEventPusherWithInstanceID(
"INSTANCE",
instance.NewCustomTextSetEvent(context.Background(),
&instance.NewAggregate("INSTANCE").Aggregate, domain.LoginCustomText, domain.LoginKeyRegistrationOptionLoginButtonText, "LoginButtonText", language.English,
),
),
eventFromEventPusherWithInstanceID(
"INSTANCE",
instance.NewCustomTextSetEvent(context.Background(),
@@ -8481,6 +8518,7 @@ func TestCommandSide_SetCustomIAMLoginText(t *testing.T) {
Description: "Description",
RegisterUsernamePasswordButtonText: "RegisterUsernamePasswordButtonText",
ExternalLoginDescription: "ExternalLoginDescription",
LoginButtonText: "LoginButtonText",
},
RegistrationUser: domain.RegistrationUserScreenText{
Title: "Title",