@nxgt/janus-mail 0.7.0 → 0.7.1
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/README.md +9 -3
- package/docs/guide/sending.md +15 -9
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -165,7 +165,10 @@ await mail.verifyEmail(issued, { name: user.name, locale: 'fr' }, { expiresIn: '
|
|
|
165
165
|
### Telling a user their password or e-mail changed
|
|
166
166
|
|
|
167
167
|
`@nxgt/janus` 0.14 sends `user.passwordChanged` once `changePassword` or
|
|
168
|
-
`setPassword` wrote the password
|
|
168
|
+
`setPassword` wrote the password — and 0.16 once `signInCode.confirm` or
|
|
169
|
+
`magicLink.confirm` dropped a password when proving the e-mail for the
|
|
170
|
+
first time, so the inbox's owner hears of a password someone else had set —
|
|
171
|
+
and `user.emailChanged` once `update`
|
|
169
172
|
changed the e-mail. The e-mail change is told to the **former** address — the
|
|
170
173
|
new one belongs to whoever changed it — which the event carries as
|
|
171
174
|
`formerEmail`, `null` for a user who had none:
|
|
@@ -195,8 +198,11 @@ see [Sending](docs/guide/sending.md#emailchangedto).
|
|
|
195
198
|
|
|
196
199
|
`@nxgt/janus` sends `user.secondFactorEnabled` once `secondFactor.activate`
|
|
197
200
|
made the factor active, and `user.secondFactorDisabled` once
|
|
198
|
-
`secondFactor.disable` removed an active one —
|
|
199
|
-
|
|
201
|
+
`secondFactor.disable` removed an active one — and, from 0.16, once
|
|
202
|
+
`signInCode.confirm` or `magicLink.confirm` removed one when proving the
|
|
203
|
+
e-mail for the first time, so the inbox's owner hears of a factor someone else
|
|
204
|
+
had set — never for a user who had none. The event names the user by id, so
|
|
205
|
+
read the rest from the user:
|
|
200
206
|
|
|
201
207
|
```ts
|
|
202
208
|
const auth = janus({
|
package/docs/guide/sending.md
CHANGED
|
@@ -161,8 +161,10 @@ const auth = janus({
|
|
|
161
161
|
|
|
162
162
|
A notice: the password of the account at `to.email` changed, with a link to
|
|
163
163
|
`links.secureAccount()` for a user who did not change it. Send it on the
|
|
164
|
-
`user.passwordChanged` event, which `changePassword` and `setPassword` send
|
|
165
|
-
|
|
164
|
+
`user.passwordChanged` event, which `changePassword` and `setPassword` send —
|
|
165
|
+
and, from `@nxgt/janus` 0.16, `signInCode.confirm` and `magicLink.confirm`
|
|
166
|
+
when their first proof of the e-mail dropped a password someone may have set
|
|
167
|
+
without holding the inbox. A reset sends `user.passwordReset` instead, never both: to tell a reset too,
|
|
166
168
|
send the same notice on that type — `event.type === 'user.passwordChanged'
|
|
167
169
|
|| event.type === 'user.passwordReset'`. The event names the user by id
|
|
168
170
|
alone, so read the name, the locale and the address from the user.
|
|
@@ -210,17 +212,21 @@ const auth = janus({
|
|
|
210
212
|
});
|
|
211
213
|
```
|
|
212
214
|
|
|
213
|
-
Two notices: two-factor authentication was turned on, or off, for the
|
|
214
|
-
|
|
215
|
-
|
|
215
|
+
Two notices: two-factor authentication was turned on, or off, for the account
|
|
216
|
+
at `to.email`, each with a link to `links.secureAccount()` — the user's
|
|
217
|
+
security settings — for a user who did not make the change. Send
|
|
216
218
|
`twoFactorEnabled` on the `user.secondFactorEnabled` event, which
|
|
217
219
|
`auth.secondFactor.activate` sends once the factor is active, and
|
|
218
220
|
`twoFactorDisabled` on `user.secondFactorDisabled`, which
|
|
219
221
|
`auth.secondFactor.disable` sends only when it removed an active factor: a
|
|
220
|
-
`disable` on a user who had none tells nobody anything.
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
222
|
+
`disable` on a user who had none tells nobody anything. From `@nxgt/janus`
|
|
223
|
+
0.16, `signInCode.confirm` and `magicLink.confirm` send it too when their
|
|
224
|
+
first proof of the e-mail removed a factor someone may have enrolled without
|
|
225
|
+
holding the inbox — after `user.passwordChanged`, so the inbox's owner gets
|
|
226
|
+
both notices. The event names the user by id alone, so read the name, the
|
|
227
|
+
locale and the address from the user. Calling them right after `activate` or
|
|
228
|
+
`disable` answered works as well — without the events, check `hasSecondFactor`
|
|
229
|
+
before the `disable`.
|
|
224
230
|
|
|
225
231
|
### `welcome(to)`
|
|
226
232
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nxgt/janus-mail",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "The e-mails of @nxgt/janus's flows — e-mail verification, password reset, sign-in code, sign-in link, password changed, e-mail changed, two-factor enabled and disabled, recovery code used, welcome — rendered in English and French from a prebuilt Maizzle build, with your brand, sent through any @nxgt/mail transport",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@maizzle/framework": "6.1.7",
|
|
55
55
|
"@maizzle/tailwindcss": "1.5.6",
|
|
56
56
|
"@formatjs/icu-messageformat-parser": "3.5.20",
|
|
57
|
-
"@nxgt/janus": "^0.
|
|
57
|
+
"@nxgt/janus": "^0.16.0",
|
|
58
58
|
"@nxgt/mail": "1.0.1",
|
|
59
59
|
"@nxgt/mail-config": "1.0.1",
|
|
60
60
|
"@nxgt/mail-i18n": "1.0.1",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"zod": "^4.6.5"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@nxgt/janus": "^0.
|
|
69
|
+
"@nxgt/janus": "^0.16.0",
|
|
70
70
|
"@nxgt/mail": ">=0.1.0 <2",
|
|
71
71
|
"typescript": "^6.0.3"
|
|
72
72
|
}
|