You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 573cffe
Browse filesBrowse the repository at this point in the historyBrowse files
`Device: ${[browser, os].filter(Boolean).join(' on ') ||'unknown'}`,
179
+
`IP: ${session.ip??'unknown'}`,
180
+
`Country: ${session.country??'unknown'}`,
181
+
'',
182
+
'If this was you, you can ignore this email. Otherwise, end the session here:',
183
+
`${process.env.ADMIN_URL}${revokePath}`,
184
+
].join('\n');
185
+
186
+
const { error } =awaitemailAdapter.sendEmail(
187
+
'noreply@yourapp.com', user.email, text, undefined, 'New sign-in to your account',
188
+
);
189
+
if (error) {
190
+
thrownewError(error);
191
+
}
192
+
},
193
+
}),
194
+
],
195
+
...
196
+
});
197
+
```
198
+
199
+
The sender address or its domain must be verified in SES, see the SES setup steps in the
200
+
[Email Invite](/docs/tutorial/Plugins/email-invite#ses) plugin docs. The example sends plain text: if you
201
+
add HTML, escape the values of `session`, the IP may come from a request header. An error thrown from the
202
+
callback is logged by the plugin and doesn't affect the sign-in.
203
+
92
204
## Options
93
205
94
206
| Option | Default | Description |
@@ -99,3 +211,4 @@ new UserSessionsPlugin({
99
211
|`resolveCountry`| — | Called when the header did not tell the country |
100
212
|`canManageOtherUsersSessions`| — |`(adminUser) => Promise<boolean>`, decides who may see and revoke sessions of other users |
101
213
|`lastUsedThrottleSeconds`|`60`| How often `last_used_at` is refreshed. Every refresh is one write to the adapter |
214
+
|`onNewLogin`| — |`({ pk, username, session, reasons, revokePath }) => Promise<void>`, called after a sign-in from a new device or country, see [Notifying about sign-ins from new devices](#notifying-about-sign-ins-from-new-devices)|
0 commit comments