mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-06 13:27:45 +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_done_text | PasswordlessRegistrationDoneScreenText | - | |
|
||||
| external_registration_user_overview_text | ExternalRegistrationUserOverviewScreenText | - | |
|
||||
| is_default | bool | - | |
|
||||
|
||||
|
||||
|
||||
|
@ -34,6 +34,7 @@ func CustomLoginTextToPb(text *domain.CustomLoginText) *text_pb.LoginCustomText
|
||||
text.ChangeDate,
|
||||
text.AggregateID,
|
||||
),
|
||||
IsDefault: text.IsDefault,
|
||||
SelectAccountText: SelectAccountScreenToPb(text.SelectAccount),
|
||||
LoginText: LoginScreenTextToPb(text.Login),
|
||||
PasswordText: PasswordScreenTextToPb(text.Password),
|
||||
|
@ -300,9 +300,10 @@ const (
|
||||
type CustomLoginText struct {
|
||||
models.ObjectRoot
|
||||
|
||||
State PolicyState
|
||||
Default bool
|
||||
Language language.Tag
|
||||
State PolicyState
|
||||
Default bool
|
||||
Language language.Tag
|
||||
IsDefault bool
|
||||
|
||||
SelectAccount SelectAccountScreenText
|
||||
Login LoginScreenText
|
||||
|
@ -131,6 +131,8 @@ func (q *Queries) GetDefaultLoginTexts(ctx context.Context, lang string) (*domai
|
||||
if err := yaml.Unmarshal(contents, loginText); err != nil {
|
||||
return nil, errors.ThrowInternal(err, "TEXT-M0p4s", "Errors.TranslationFile.ReadError")
|
||||
}
|
||||
loginText.IsDefault = true
|
||||
loginText.AggregateID = domain.IAMID
|
||||
return loginText, nil
|
||||
}
|
||||
|
||||
@ -139,7 +141,7 @@ func (q *Queries) GetCustomLoginTexts(ctx context.Context, aggregateID, lang str
|
||||
if err != nil {
|
||||
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) {
|
||||
@ -171,6 +173,8 @@ func (q *Queries) IAMLoginTexts(ctx context.Context, lang string) (*domain.Custo
|
||||
if err := json.Unmarshal(jsonbody, &loginText); err != nil {
|
||||
return nil, errors.ThrowInternal(err, "QUERY-m93Jf", "Errors.TranslationFile.MergeError")
|
||||
}
|
||||
loginText.AggregateID = domain.IAMID
|
||||
loginText.IsDefault = true
|
||||
return loginText, nil
|
||||
}
|
||||
|
||||
@ -272,6 +276,10 @@ func CustomTextsToLoginDomain(aggregateID, lang string, texts *CustomTexts) *dom
|
||||
},
|
||||
Language: langTag,
|
||||
}
|
||||
if len(texts.CustomTexts) == 0 {
|
||||
result.AggregateID = domain.IAMID
|
||||
result.IsDefault = true
|
||||
}
|
||||
for _, text := range texts.CustomTexts {
|
||||
if text.CreationDate.Before(result.CreationDate) {
|
||||
result.CreationDate = text.CreationDate
|
||||
|
@ -84,6 +84,7 @@ message LoginCustomText {
|
||||
PasswordlessRegistrationScreenText passwordless_registration_text = 33;
|
||||
PasswordlessRegistrationDoneScreenText passwordless_registration_done_text = 34;
|
||||
ExternalRegistrationUserOverviewScreenText external_registration_user_overview_text = 35;
|
||||
bool is_default = 36;
|
||||
}
|
||||
|
||||
message SelectAccountScreenText {
|
||||
|
Loading…
x
Reference in New Issue
Block a user