From da181b9e8ca7ce6f467d65a2fceab32c30c1f6d7 Mon Sep 17 00:00:00 2001 From: Fabi <38692350+fgerschwiler@users.noreply.github.com> Date: Tue, 13 Jul 2021 15:04:02 +0200 Subject: [PATCH] fix: sms notification (#2013) * fix: phone verifications * feat: fix password reset as sms * fix: phone verification --- internal/notification/types/password_code.go | 4 ++++ internal/notification/types/phone_verification_code.go | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/notification/types/password_code.go b/internal/notification/types/password_code.go index 0e8e4d3a0..04a8828fc 100644 --- a/internal/notification/types/password_code.go +++ b/internal/notification/types/password_code.go @@ -40,5 +40,9 @@ func SendPasswordCode(mailhtml string, translator *i18n.Translator, user *view_m if err != nil { return err } + if code.NotificationType == int32(domain.NotificationTypeSms) { + return generateSms(user, passwordResetData.Text, systemDefaults.Notifications, false) + } return generateEmail(user, passwordResetData.Subject, template, systemDefaults.Notifications, true) + } diff --git a/internal/notification/types/phone_verification_code.go b/internal/notification/types/phone_verification_code.go index 55fe9ad3c..16c5fc3be 100644 --- a/internal/notification/types/phone_verification_code.go +++ b/internal/notification/types/phone_verification_code.go @@ -24,7 +24,7 @@ func SendPhoneVerificationCode(translator *i18n.Translator, user *view_model.Not var args = mapNotifyUserToArgs(user) args["Code"] = codeString - text := translator.Localize(fmt.Sprintf("%s.%s", domain.VerifyPhoneMessageType, domain.MessageTitle), args, user.PreferredLanguage) + text := translator.Localize(fmt.Sprintf("%s.%s", domain.VerifyPhoneMessageType, domain.MessageText), args, user.PreferredLanguage) codeData := &PhoneVerificationCodeData{UserID: user.ID} template, err := templates.ParseTemplateText(text, codeData)