mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 19:44:21 +00:00
343a9428b3
* manage 2 custom texts proto * implement methods * default texts * console * improve translations * lint * test: fix e2e timeout * fix translations * add missing console translations * remove unused text parts --------- Co-authored-by: Livio Spring <livio.a@gmail.com>
69 lines
2.1 KiB
Go
69 lines
2.1 KiB
Go
package domain
|
|
|
|
import (
|
|
"golang.org/x/text/language"
|
|
|
|
"github.com/zitadel/zitadel/internal/eventstore/v1/models"
|
|
)
|
|
|
|
const (
|
|
InitCodeMessageType = "InitCode"
|
|
PasswordResetMessageType = "PasswordReset"
|
|
VerifyEmailMessageType = "VerifyEmail"
|
|
VerifyPhoneMessageType = "VerifyPhone"
|
|
VerifySMSOTPMessageType = "VerifySMSOTP"
|
|
VerifyEmailOTPMessageType = "VerifyEmailOTP"
|
|
DomainClaimedMessageType = "DomainClaimed"
|
|
PasswordlessRegistrationMessageType = "PasswordlessRegistration"
|
|
PasswordChangeMessageType = "PasswordChange"
|
|
MessageTitle = "Title"
|
|
MessagePreHeader = "PreHeader"
|
|
MessageSubject = "Subject"
|
|
MessageGreeting = "Greeting"
|
|
MessageText = "Text"
|
|
MessageButtonText = "ButtonText"
|
|
MessageFooterText = "Footer"
|
|
)
|
|
|
|
type MessageTexts struct {
|
|
InitCode CustomMessageText
|
|
PasswordReset CustomMessageText
|
|
VerifyEmail CustomMessageText
|
|
VerifyPhone CustomMessageText
|
|
DomainClaimed CustomMessageText
|
|
PasswordlessRegistration CustomMessageText
|
|
PasswordChange CustomMessageText
|
|
}
|
|
|
|
type CustomMessageText struct {
|
|
models.ObjectRoot
|
|
|
|
State PolicyState
|
|
Default bool
|
|
MessageTextType string
|
|
Language language.Tag
|
|
Title string
|
|
PreHeader string
|
|
Subject string
|
|
Greeting string
|
|
Text string
|
|
ButtonText string
|
|
FooterText string
|
|
}
|
|
|
|
func (m *CustomMessageText) IsValid() bool {
|
|
return m.MessageTextType != "" && m.Language != language.Und
|
|
}
|
|
|
|
func IsMessageTextType(textType string) bool {
|
|
return textType == InitCodeMessageType ||
|
|
textType == PasswordResetMessageType ||
|
|
textType == VerifyEmailMessageType ||
|
|
textType == VerifyPhoneMessageType ||
|
|
textType == VerifySMSOTPMessageType ||
|
|
textType == VerifyEmailOTPMessageType ||
|
|
textType == DomainClaimedMessageType ||
|
|
textType == PasswordlessRegistrationMessageType ||
|
|
textType == PasswordChangeMessageType
|
|
}
|