feat: SMS and email OTP texts (#6281)

* 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>
This commit is contained in:
Elio Bischof
2023-08-09 07:49:12 +02:00
committed by GitHub
parent 9aed9f9186
commit 343a9428b3
39 changed files with 1508 additions and 188 deletions

View File

@@ -11,6 +11,8 @@ const (
PasswordResetMessageType = "PasswordReset"
VerifyEmailMessageType = "VerifyEmail"
VerifyPhoneMessageType = "VerifyPhone"
VerifySMSOTPMessageType = "VerifySMSOTP"
VerifyEmailOTPMessageType = "VerifyEmailOTP"
DomainClaimedMessageType = "DomainClaimed"
PasswordlessRegistrationMessageType = "PasswordlessRegistration"
PasswordChangeMessageType = "PasswordChange"
@@ -53,31 +55,13 @@ func (m *CustomMessageText) IsValid() bool {
return m.MessageTextType != "" && m.Language != language.Und
}
func (m *MessageTexts) GetMessageTextByType(msgType string) *CustomMessageText {
switch msgType {
case InitCodeMessageType:
return &m.InitCode
case PasswordResetMessageType:
return &m.PasswordReset
case VerifyEmailMessageType:
return &m.VerifyEmail
case VerifyPhoneMessageType:
return &m.VerifyPhone
case DomainClaimedMessageType:
return &m.DomainClaimed
case PasswordlessRegistrationMessageType:
return &m.PasswordlessRegistration
case PasswordChangeMessageType:
return &m.PasswordChange
}
return nil
}
func IsMessageTextType(textType string) bool {
return textType == InitCodeMessageType ||
textType == PasswordResetMessageType ||
textType == VerifyEmailMessageType ||
textType == VerifyPhoneMessageType ||
textType == VerifySMSOTPMessageType ||
textType == VerifyEmailOTPMessageType ||
textType == DomainClaimedMessageType ||
textType == PasswordlessRegistrationMessageType ||
textType == PasswordChangeMessageType