mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 06:07:33 +00:00
chore: move the go code into a subfolder
This commit is contained in:
67
apps/api/internal/domain/custom_message_text.go
Normal file
67
apps/api/internal/domain/custom_message_text.go
Normal file
@@ -0,0 +1,67 @@
|
||||
package domain
|
||||
|
||||
import (
|
||||
"golang.org/x/text/language"
|
||||
|
||||
"github.com/zitadel/zitadel/internal/eventstore/v1/models"
|
||||
"github.com/zitadel/zitadel/internal/zerrors"
|
||||
)
|
||||
|
||||
const (
|
||||
InitCodeMessageType = "InitCode"
|
||||
PasswordResetMessageType = "PasswordReset"
|
||||
VerifyEmailMessageType = "VerifyEmail"
|
||||
VerifyPhoneMessageType = "VerifyPhone"
|
||||
VerifySMSOTPMessageType = "VerifySMSOTP"
|
||||
VerifyEmailOTPMessageType = "VerifyEmailOTP"
|
||||
DomainClaimedMessageType = "DomainClaimed"
|
||||
PasswordlessRegistrationMessageType = "PasswordlessRegistration"
|
||||
PasswordChangeMessageType = "PasswordChange"
|
||||
InviteUserMessageType = "InviteUser"
|
||||
MessageTitle = "Title"
|
||||
MessagePreHeader = "PreHeader"
|
||||
MessageSubject = "Subject"
|
||||
MessageGreeting = "Greeting"
|
||||
MessageText = "Text"
|
||||
MessageButtonText = "ButtonText"
|
||||
MessageFooterText = "Footer"
|
||||
)
|
||||
|
||||
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(supportedLanguages []language.Tag) error {
|
||||
if m.MessageTextType == "" {
|
||||
return zerrors.ThrowInvalidArgument(nil, "INSTANCE-kd9fs", "Errors.CustomMessageText.Invalid")
|
||||
}
|
||||
if err := LanguageIsDefined(m.Language); err != nil {
|
||||
return err
|
||||
}
|
||||
return LanguagesAreSupported(supportedLanguages, m.Language)
|
||||
}
|
||||
|
||||
func IsMessageTextType(textType string) bool {
|
||||
return textType == InitCodeMessageType ||
|
||||
textType == PasswordResetMessageType ||
|
||||
textType == VerifyEmailMessageType ||
|
||||
textType == VerifyPhoneMessageType ||
|
||||
textType == VerifySMSOTPMessageType ||
|
||||
textType == VerifyEmailOTPMessageType ||
|
||||
textType == DomainClaimedMessageType ||
|
||||
textType == PasswordlessRegistrationMessageType ||
|
||||
textType == PasswordChangeMessageType ||
|
||||
textType == InviteUserMessageType
|
||||
}
|
Reference in New Issue
Block a user