@fonderie/auth 2.1.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +13 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -718,6 +718,7 @@ function mfaController(store, config, issuer, bus) {
|
|
|
718
718
|
await users.confirmMfaSecret(ctx.user.id);
|
|
719
719
|
bus?.emit(NOTIFICATION_EVENT, {
|
|
720
720
|
type: MESSAGE_KEYS.mfaEnabled,
|
|
721
|
+
locale: ctx.user.locale,
|
|
721
722
|
data: {},
|
|
722
723
|
recipient: { email: ctx.user.email, phone: null, deviceToken: null }
|
|
723
724
|
}).catch(() => {
|
|
@@ -809,6 +810,7 @@ function mfaController(store, config, issuer, bus) {
|
|
|
809
810
|
await backupCodes.replace(ctx.user.id, codeHashes);
|
|
810
811
|
bus?.emit(NOTIFICATION_EVENT, {
|
|
811
812
|
type: MESSAGE_KEYS.mfaBackupCodesRegenerated,
|
|
813
|
+
locale: ctx.user.locale,
|
|
812
814
|
data: {},
|
|
813
815
|
recipient: { email: ctx.user.email, phone: null, deviceToken: null }
|
|
814
816
|
}).catch(() => {
|
|
@@ -835,6 +837,7 @@ function mfaController(store, config, issuer, bus) {
|
|
|
835
837
|
await Promise.all([users.disableMfa(ctx.user.id), backupCodes.deleteByUser(ctx.user.id)]);
|
|
836
838
|
bus?.emit(NOTIFICATION_EVENT, {
|
|
837
839
|
type: MESSAGE_KEYS.mfaDisabled,
|
|
840
|
+
locale: user.locale,
|
|
838
841
|
data: {},
|
|
839
842
|
recipient: { email: user.email, phone: null, deviceToken: null }
|
|
840
843
|
}).catch(() => {
|
|
@@ -1082,6 +1085,7 @@ function authController(store, config, bus) {
|
|
|
1082
1085
|
NOTIFICATION_EVENT2,
|
|
1083
1086
|
{
|
|
1084
1087
|
type: MESSAGE_KEYS.emailRegistration,
|
|
1088
|
+
locale: user.locale,
|
|
1085
1089
|
data: { pin, firstName: firstName ?? "" },
|
|
1086
1090
|
recipient: { email: normalizedEmail, phone: null, deviceToken: null }
|
|
1087
1091
|
},
|
|
@@ -1145,6 +1149,7 @@ function authController(store, config, bus) {
|
|
|
1145
1149
|
NOTIFICATION_EVENT2,
|
|
1146
1150
|
{
|
|
1147
1151
|
type: MESSAGE_KEYS.phoneOtp,
|
|
1152
|
+
locale: user.locale,
|
|
1148
1153
|
data: { otp },
|
|
1149
1154
|
recipient: { email: null, phone: normalizePhone(phone2), deviceToken: null }
|
|
1150
1155
|
},
|
|
@@ -1257,6 +1262,7 @@ function authController(store, config, bus) {
|
|
|
1257
1262
|
await phoneVerif.upsert(user.id, normalizePhone(phone2), otp, expiresAt);
|
|
1258
1263
|
bus?.emit(NOTIFICATION_EVENT2, {
|
|
1259
1264
|
type: MESSAGE_KEYS.phoneOtp,
|
|
1265
|
+
locale: user.locale,
|
|
1260
1266
|
data: { otp },
|
|
1261
1267
|
recipient: { email: null, phone: normalizePhone(phone2), deviceToken: null }
|
|
1262
1268
|
}).catch(() => {
|
|
@@ -1371,6 +1377,7 @@ function authController(store, config, bus) {
|
|
|
1371
1377
|
await passwordReset.create(user.id, pin, expiresAt);
|
|
1372
1378
|
bus?.emit(NOTIFICATION_EVENT2, {
|
|
1373
1379
|
type: MESSAGE_KEYS.passwordReset,
|
|
1380
|
+
locale: user.locale,
|
|
1374
1381
|
recipient: { email: email2, phone: null, deviceToken: null },
|
|
1375
1382
|
data: { pin }
|
|
1376
1383
|
}).catch(() => {
|
|
@@ -1537,6 +1544,7 @@ function authController(store, config, bus) {
|
|
|
1537
1544
|
await phoneVerif.upsert(ctx.user.id, phone2, otp, expiresAt2);
|
|
1538
1545
|
bus?.emit(NOTIFICATION_EVENT2, {
|
|
1539
1546
|
type: MESSAGE_KEYS.phoneOtp,
|
|
1547
|
+
locale: ctx.user.locale,
|
|
1540
1548
|
data: { otp },
|
|
1541
1549
|
recipient: { email: null, phone: phone2, deviceToken: null }
|
|
1542
1550
|
}).catch(() => {
|
|
@@ -1576,6 +1584,7 @@ function authController(store, config, bus) {
|
|
|
1576
1584
|
await emailVerif.replace(ctx.user.id, pin, expiresAt);
|
|
1577
1585
|
bus?.emit(NOTIFICATION_EVENT2, {
|
|
1578
1586
|
type: MESSAGE_KEYS.emailVerification,
|
|
1587
|
+
locale: ctx.user.locale,
|
|
1579
1588
|
recipient: { email: ctx.user.email, phone: null, deviceToken: null },
|
|
1580
1589
|
data: { pin }
|
|
1581
1590
|
}).catch(() => {
|
|
@@ -1687,6 +1696,7 @@ function userController(store, config, bus) {
|
|
|
1687
1696
|
await users.updateEmail(ctx.user.id, normalised);
|
|
1688
1697
|
bus?.emit(NOTIFICATION_EVENT3, {
|
|
1689
1698
|
type: MESSAGE_KEYS.emailVerification,
|
|
1699
|
+
locale: ctx.user.locale,
|
|
1690
1700
|
data: { pin },
|
|
1691
1701
|
recipient: { email: normalised, phone: null, deviceToken: null }
|
|
1692
1702
|
}).catch(() => {
|
|
@@ -1694,6 +1704,7 @@ function userController(store, config, bus) {
|
|
|
1694
1704
|
if (oldEmail) {
|
|
1695
1705
|
bus?.emit(NOTIFICATION_EVENT3, {
|
|
1696
1706
|
type: MESSAGE_KEYS.emailChanged,
|
|
1707
|
+
locale: ctx.user.locale,
|
|
1697
1708
|
data: { newEmail: normalised },
|
|
1698
1709
|
recipient: { email: oldEmail, phone: null, deviceToken: null }
|
|
1699
1710
|
}).catch(() => {
|
|
@@ -1729,6 +1740,7 @@ function userController(store, config, bus) {
|
|
|
1729
1740
|
await users.updatePhone(ctx.user.id, normalised);
|
|
1730
1741
|
bus?.emit(NOTIFICATION_EVENT3, {
|
|
1731
1742
|
type: MESSAGE_KEYS.phoneOtp,
|
|
1743
|
+
locale: ctx.user.locale,
|
|
1732
1744
|
data: { otp },
|
|
1733
1745
|
recipient: { email: null, phone: normalised, deviceToken: null }
|
|
1734
1746
|
}).catch(() => {
|
|
@@ -1736,6 +1748,7 @@ function userController(store, config, bus) {
|
|
|
1736
1748
|
if (ctx.user.email) {
|
|
1737
1749
|
bus?.emit(NOTIFICATION_EVENT3, {
|
|
1738
1750
|
type: MESSAGE_KEYS.phoneChanged,
|
|
1751
|
+
locale: ctx.user.locale,
|
|
1739
1752
|
data: {},
|
|
1740
1753
|
recipient: { email: ctx.user.email, phone: null, deviceToken: null }
|
|
1741
1754
|
}).catch(() => {
|