fix: sms notification (#2013)

* fix: phone verifications

* feat: fix password reset as sms

* fix: phone verification
This commit is contained in:
Fabi 2021-07-13 15:04:02 +02:00 committed by GitHub
parent 03a38fbf1c
commit da181b9e8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -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)
}

View File

@ -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)