mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-07 22:37:40 +00:00
fix: return isDefault on login texts (#3076)
* fix: add is disabled to login texts * fix: fix aggregate id
This commit is contained in:
parent
5c6df06a7c
commit
087ef8d31c
@ -278,6 +278,7 @@ title: zitadel/text.proto
|
|||||||
| passwordless_registration_text | PasswordlessRegistrationScreenText | - | |
|
| passwordless_registration_text | PasswordlessRegistrationScreenText | - | |
|
||||||
| passwordless_registration_done_text | PasswordlessRegistrationDoneScreenText | - | |
|
| passwordless_registration_done_text | PasswordlessRegistrationDoneScreenText | - | |
|
||||||
| external_registration_user_overview_text | ExternalRegistrationUserOverviewScreenText | - | |
|
| external_registration_user_overview_text | ExternalRegistrationUserOverviewScreenText | - | |
|
||||||
|
| is_default | bool | - | |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ func CustomLoginTextToPb(text *domain.CustomLoginText) *text_pb.LoginCustomText
|
|||||||
text.ChangeDate,
|
text.ChangeDate,
|
||||||
text.AggregateID,
|
text.AggregateID,
|
||||||
),
|
),
|
||||||
|
IsDefault: text.IsDefault,
|
||||||
SelectAccountText: SelectAccountScreenToPb(text.SelectAccount),
|
SelectAccountText: SelectAccountScreenToPb(text.SelectAccount),
|
||||||
LoginText: LoginScreenTextToPb(text.Login),
|
LoginText: LoginScreenTextToPb(text.Login),
|
||||||
PasswordText: PasswordScreenTextToPb(text.Password),
|
PasswordText: PasswordScreenTextToPb(text.Password),
|
||||||
|
@ -300,9 +300,10 @@ const (
|
|||||||
type CustomLoginText struct {
|
type CustomLoginText struct {
|
||||||
models.ObjectRoot
|
models.ObjectRoot
|
||||||
|
|
||||||
State PolicyState
|
State PolicyState
|
||||||
Default bool
|
Default bool
|
||||||
Language language.Tag
|
Language language.Tag
|
||||||
|
IsDefault bool
|
||||||
|
|
||||||
SelectAccount SelectAccountScreenText
|
SelectAccount SelectAccountScreenText
|
||||||
Login LoginScreenText
|
Login LoginScreenText
|
||||||
|
@ -131,6 +131,8 @@ func (q *Queries) GetDefaultLoginTexts(ctx context.Context, lang string) (*domai
|
|||||||
if err := yaml.Unmarshal(contents, loginText); err != nil {
|
if err := yaml.Unmarshal(contents, loginText); err != nil {
|
||||||
return nil, errors.ThrowInternal(err, "TEXT-M0p4s", "Errors.TranslationFile.ReadError")
|
return nil, errors.ThrowInternal(err, "TEXT-M0p4s", "Errors.TranslationFile.ReadError")
|
||||||
}
|
}
|
||||||
|
loginText.IsDefault = true
|
||||||
|
loginText.AggregateID = domain.IAMID
|
||||||
return loginText, nil
|
return loginText, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +141,7 @@ func (q *Queries) GetCustomLoginTexts(ctx context.Context, aggregateID, lang str
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return CustomTextsToLoginDomain(domain.IAMID, lang, texts), err
|
return CustomTextsToLoginDomain(aggregateID, lang, texts), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (q *Queries) IAMLoginTexts(ctx context.Context, lang string) (*domain.CustomLoginText, error) {
|
func (q *Queries) IAMLoginTexts(ctx context.Context, lang string) (*domain.CustomLoginText, error) {
|
||||||
@ -171,6 +173,8 @@ func (q *Queries) IAMLoginTexts(ctx context.Context, lang string) (*domain.Custo
|
|||||||
if err := json.Unmarshal(jsonbody, &loginText); err != nil {
|
if err := json.Unmarshal(jsonbody, &loginText); err != nil {
|
||||||
return nil, errors.ThrowInternal(err, "QUERY-m93Jf", "Errors.TranslationFile.MergeError")
|
return nil, errors.ThrowInternal(err, "QUERY-m93Jf", "Errors.TranslationFile.MergeError")
|
||||||
}
|
}
|
||||||
|
loginText.AggregateID = domain.IAMID
|
||||||
|
loginText.IsDefault = true
|
||||||
return loginText, nil
|
return loginText, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,6 +276,10 @@ func CustomTextsToLoginDomain(aggregateID, lang string, texts *CustomTexts) *dom
|
|||||||
},
|
},
|
||||||
Language: langTag,
|
Language: langTag,
|
||||||
}
|
}
|
||||||
|
if len(texts.CustomTexts) == 0 {
|
||||||
|
result.AggregateID = domain.IAMID
|
||||||
|
result.IsDefault = true
|
||||||
|
}
|
||||||
for _, text := range texts.CustomTexts {
|
for _, text := range texts.CustomTexts {
|
||||||
if text.CreationDate.Before(result.CreationDate) {
|
if text.CreationDate.Before(result.CreationDate) {
|
||||||
result.CreationDate = text.CreationDate
|
result.CreationDate = text.CreationDate
|
||||||
|
@ -84,6 +84,7 @@ message LoginCustomText {
|
|||||||
PasswordlessRegistrationScreenText passwordless_registration_text = 33;
|
PasswordlessRegistrationScreenText passwordless_registration_text = 33;
|
||||||
PasswordlessRegistrationDoneScreenText passwordless_registration_done_text = 34;
|
PasswordlessRegistrationDoneScreenText passwordless_registration_done_text = 34;
|
||||||
ExternalRegistrationUserOverviewScreenText external_registration_user_overview_text = 35;
|
ExternalRegistrationUserOverviewScreenText external_registration_user_overview_text = 35;
|
||||||
|
bool is_default = 36;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SelectAccountScreenText {
|
message SelectAccountScreenText {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user