feat(console): message and login texts, privacy policy (#2016)

* message texts wrapper components

* message-text sub, i18n, grid

* fix routing

* pack

* pack

* update material

* audit

* fix mgmt service for labelplcy

* map conv

* edit text from map

* request map

* fetch data, mgmt admin service

* warn box, i18n

* resetbtn

* login texts

* login text requests

* reset, default, i18n

* disabled, features, message text setter, service

* locale switcher

* policy grid

* password reset, domain claimed i18n

* lint files

* fix admin service, i18n, lang setter

* fix scss duplicate

* privacy policy, cleanup grid, fix message, login texts (#2031)

* policy grid everywhere 🦒

* cleanup home

* log login text request

* patch all data

* refresh toggle

* fix: add dialog for unsaved changes (#2057)

* logintexts dialog

* check for dialog on pairwise operation

* fix: patch value to local state after save

* fix: i18n and custom login texts (#2060)

* fix: i18n and custom login texts

* fix: tos and privacy texts

* fix frontend

* fix: tos and privacy texts and tests

* fix: i18n, tos and privacy texts and tests

* fix frontend maps

* i18n

* add ResetCustomLoginTextToDefault in admin api and fix template remove in handlers

* resetlogintexttodefault

Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
Max Peintner
2021-07-26 12:44:45 +02:00
committed by GitHub
parent 26e4e607bc
commit 2e684684de
100 changed files with 4500 additions and 2259 deletions

View File

@@ -55,8 +55,9 @@ const (
MailTemplateAdded models.EventType = "iam.mail.template.added"
MailTemplateChanged models.EventType = "iam.mail.template.changed"
CustomTextSet models.EventType = "iam.customtext.set"
CustomTextRemoved models.EventType = "iam.customtext.removed"
CustomTextSet models.EventType = "iam.customtext.set"
CustomTextRemoved models.EventType = "iam.customtext.removed"
CustomTextMessageRemoved models.EventType = "iam.customtext.template.removed"
PasswordComplexityPolicyAdded models.EventType = "iam.policy.password.complexity.added"
PasswordComplexityPolicyChanged models.EventType = "iam.policy.password.complexity.changed"

View File

@@ -86,3 +86,11 @@ func DeleteCustomText(db *gorm.DB, table, aggregateID, template, lang, key strin
delete := repository.PrepareDeleteByKeys(table, aggregateIDSearch, templateSearch, keySearch, languageSearch)
return delete(db)
}
func DeleteCustomTextTemplate(db *gorm.DB, table, aggregateID, template, lang string) error {
aggregateIDSearch := repository.Key{Key: model.CustomTextSearchKey(iam_model.CustomTextSearchKeyAggregateID), Value: aggregateID}
templateSearch := repository.Key{Key: model.CustomTextSearchKey(iam_model.CustomTextSearchKeyTemplate), Value: template}
languageSearch := repository.Key{Key: model.CustomTextSearchKey(iam_model.CustomTextSearchKeyLanguage), Value: lang}
delete := repository.PrepareDeleteByKeys(table, aggregateIDSearch, templateSearch, languageSearch)
return delete(db)
}

View File

@@ -16,7 +16,6 @@ import (
caos_errs "github.com/caos/zitadel/internal/errors"
"github.com/caos/zitadel/internal/eventstore/v1/models"
"github.com/caos/zitadel/internal/iam/model"
)
const (
@@ -39,19 +38,6 @@ type CustomTextView struct {
Sequence uint64 `json:"-" gorm:"column:sequence"`
}
func CustomTextViewFromModel(template *model.CustomTextView) *CustomTextView {
return &CustomTextView{
AggregateID: template.AggregateID,
Sequence: template.Sequence,
CreationDate: template.CreationDate,
ChangeDate: template.ChangeDate,
Language: template.Language.String(),
Template: template.Template,
Key: template.Key,
Text: template.Text,
}
}
func CustomTextViewsToDomain(texts []*CustomTextView) []*domain.CustomText {
result := make([]*domain.CustomText, len(texts))
for i, text := range texts {
@@ -323,7 +309,7 @@ func loginKeyToDomain(text *CustomTextView, result *domain.CustomLoginText) {
}
func passwordKeyToDomain(text *CustomTextView, result *domain.CustomLoginText) {
if text.Key == domain.LoginKeyPasswordlessValidateTokenButtonText {
if text.Key == domain.LoginKeyPasswordTitle {
result.Password.Title = text.Text
}
if text.Key == domain.LoginKeyPasswordDescription {
@@ -491,7 +477,7 @@ func initializeUserKeyToDomain(text *CustomTextView, result *domain.CustomLoginT
}
func initializeUserDoneKeyToDomain(text *CustomTextView, result *domain.CustomLoginText) {
if text.Key == domain.LoginKeyInitUserDone {
if text.Key == domain.LoginKeyInitUserDoneTitle {
result.InitUserDone.Title = text.Text
}
if text.Key == domain.LoginKeyInitUserDoneDescription {
@@ -755,24 +741,15 @@ func registrationUserKeyToDomain(text *CustomTextView, result *domain.CustomLogi
if text.Key == domain.LoginKeyRegistrationUserTOSConfirm {
result.RegistrationUser.TOSConfirm = text.Text
}
if text.Key == domain.LoginKeyRegistrationUserTOSLink {
result.RegistrationUser.TOSLink = text.Text
}
if text.Key == domain.LoginKeyRegistrationUserTOSLinkText {
result.RegistrationUser.TOSLinkText = text.Text
}
if text.Key == domain.LoginKeyRegistrationUserPrivacyConfirm {
result.RegistrationUser.PrivacyConfirm = text.Text
}
if text.Key == domain.LoginKeyRegistrationUserPrivacyLink {
result.RegistrationUser.PrivacyLink = text.Text
if text.Key == domain.LoginKeyRegistrationUserTOSConfirmAnd {
result.RegistrationUser.TOSConfirmAnd = text.Text
}
if text.Key == domain.LoginKeyRegistrationUserPrivacyLinkText {
result.RegistrationUser.PrivacyLinkText = text.Text
}
if text.Key == domain.LoginKeyRegistrationUserExternalLoginDescription {
result.RegistrationUser.ExternalLoginDescription = text.Text
}
if text.Key == domain.LoginKeyRegistrationUserNextButtonText {
result.RegistrationUser.NextButtonText = text.Text
}
@@ -815,24 +792,15 @@ func registrationOrgKeyToDomain(text *CustomTextView, result *domain.CustomLogin
if text.Key == domain.LoginKeyRegisterOrgTOSConfirm {
result.RegistrationOrg.TOSConfirm = text.Text
}
if text.Key == domain.LoginKeyRegisterOrgTOSLink {
result.RegistrationOrg.TOSLink = text.Text
}
if text.Key == domain.LoginKeyRegisterOrgTOSLinkText {
result.RegistrationOrg.TOSLinkText = text.Text
}
if text.Key == domain.LoginKeyRegisterOrgPrivacyConfirm {
result.RegistrationOrg.PrivacyConfirm = text.Text
}
if text.Key == domain.LoginKeyRegisterOrgPrivacyLink {
result.RegistrationOrg.PrivacyLink = text.Text
if text.Key == domain.LoginKeyRegisterOrgTosConfirmAnd {
result.RegistrationOrg.TOSConfirmAnd = text.Text
}
if text.Key == domain.LoginKeyRegisterOrgPrivacyLinkText {
result.RegistrationOrg.PrivacyLinkText = text.Text
}
if text.Key == domain.LoginKeyRegisterOrgExternalLoginDescription {
result.RegistrationOrg.ExternalLoginDescription = text.Text
}
if text.Key == domain.LoginKeyRegisterOrgSaveButtonText {
result.RegistrationOrg.SaveButtonText = text.Text
}
@@ -899,15 +867,9 @@ func footerKeyToDomain(text *CustomTextView, result *domain.CustomLoginText) {
if text.Key == domain.LoginKeyFooterTOS {
result.Footer.TOS = text.Text
}
if text.Key == domain.LoginKeyFooterTOSLink {
result.Footer.TOSLink = text.Text
}
if text.Key == domain.LoginKeyFooterPrivacy {
if text.Key == domain.LoginKeyFooterPrivacyPolicy {
result.Footer.PrivacyPolicy = text.Text
}
if text.Key == domain.LoginKeyFooterPrivacyLink {
result.Footer.PrivacyPolicyLink = text.Text
}
if text.Key == domain.LoginKeyFooterHelp {
result.Footer.Help = text.Text
}