🐛 Fix wrong type of notify OTP
This commit is contained in:
parent
64fd2f3cd9
commit
76682ab27f
@ -2,10 +2,11 @@ package services
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.solsynth.dev/hypernet/nexus/pkg/nex/localize"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"git.solsynth.dev/hypernet/nexus/pkg/nex/localize"
|
||||||
|
|
||||||
"git.solsynth.dev/hypernet/passport/pkg/authkit/models"
|
"git.solsynth.dev/hypernet/passport/pkg/authkit/models"
|
||||||
"git.solsynth.dev/hypernet/passport/pkg/internal/database"
|
"git.solsynth.dev/hypernet/passport/pkg/internal/database"
|
||||||
"git.solsynth.dev/hypernet/passport/pkg/internal/gap"
|
"git.solsynth.dev/hypernet/passport/pkg/internal/gap"
|
||||||
@ -75,14 +76,14 @@ func GetFactorCode(factor models.AuthFactor, ip string) (bool, error) {
|
|||||||
log.Info().Uint("factor", factor.ID).Str("secret", secret).Msg("Published one-time-password to JetStream...")
|
log.Info().Uint("factor", factor.ID).Str("secret", secret).Msg("Published one-time-password to JetStream...")
|
||||||
}
|
}
|
||||||
|
|
||||||
err = PushNotification(models.Notification{
|
err = NewNotification(models.Notification{
|
||||||
Topic: "passport.security.otp",
|
Topic: "passport.security.otp",
|
||||||
Title: localize.L.GetLocalizedString("subjectLoginOneTimePassword", user.Language),
|
Title: localize.L.GetLocalizedString("subjectLoginOneTimePassword", user.Language),
|
||||||
Body: fmt.Sprintf(localize.L.GetLocalizedString("shortBodyLoginOneTimePassword", user.Language), secret),
|
Body: fmt.Sprintf(localize.L.GetLocalizedString("shortBodyLoginOneTimePassword", user.Language), secret),
|
||||||
Account: user,
|
Account: user,
|
||||||
AccountID: user.ID,
|
AccountID: user.ID,
|
||||||
Metadata: map[string]any{"secret": secret},
|
Metadata: map[string]any{"secret": secret},
|
||||||
}, true)
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warn().Err(err).Uint("factor", factor.ID).Msg("Failed to delivery one-time-password via notify...")
|
log.Warn().Err(err).Uint("factor", factor.ID).Msg("Failed to delivery one-time-password via notify...")
|
||||||
return true, nil
|
return true, nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user