@xeplr/auth 1.1.1 → 1.1.2
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/index.js +34 -3
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -200,6 +200,13 @@ async function boot() {
|
|
|
200
200
|
|
|
201
201
|
// Configure email (via @xeplr/utils, the engine auth uses) + activation links.
|
|
202
202
|
require('@xeplr/utils').configureFromEnv();
|
|
203
|
+
|
|
204
|
+
// Whether mail can actually go out — asked, not assumed from a variable
|
|
205
|
+
// being set. Reported in the banner and NEVER fatal: sign-in works without
|
|
206
|
+
// email; only the messages that carry links (activation, invite, password
|
|
207
|
+
// reset) cannot be sent, and the banner says so rather than the first
|
|
208
|
+
// person to register finding out.
|
|
209
|
+
var email = await emailStatus();
|
|
203
210
|
authService.configureActivation({
|
|
204
211
|
// Fully qualified, one per link — the token is the only thing appended.
|
|
205
212
|
// AUTH_ACTIVATION_BASE_URL still works as an origin; see configureActivation.
|
|
@@ -219,13 +226,37 @@ async function boot() {
|
|
|
219
226
|
}
|
|
220
227
|
});
|
|
221
228
|
|
|
222
|
-
banner();
|
|
229
|
+
banner(email);
|
|
230
|
+
if (!email.ok) warnNoEmail(email);
|
|
223
231
|
return server;
|
|
224
232
|
}
|
|
225
233
|
|
|
234
|
+
async function emailStatus() {
|
|
235
|
+
var utils = require('@xeplr/utils');
|
|
236
|
+
if (typeof utils.checkEmail !== 'function') {
|
|
237
|
+
return { ok: true, unknown: true, detail: 'not checked — @xeplr/utils is too old to check' };
|
|
238
|
+
}
|
|
239
|
+
return utils.checkEmail({ timeoutMs: 5000 });
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function warnNoEmail(email) {
|
|
243
|
+
console.warn('[xeplr-auth] EMAIL IS NOT WORKING — ' + String(email.detail).replace(/\.$/, '') + '.');
|
|
244
|
+
console.warn(' Sign-in keeps working. Registration, invites and password');
|
|
245
|
+
console.warn(' resets cannot send their links until this is fixed: set');
|
|
246
|
+
console.warn(' EMAIL_PROVIDER (smtp, brevo, aws or azure) and its settings.\n');
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function describeEmail(email) {
|
|
250
|
+
if (!email) return process.env.EMAIL_PROVIDER || '(not configured)';
|
|
251
|
+
if (email.unknown) return '? ' + email.detail;
|
|
252
|
+
return email.ok
|
|
253
|
+
? '✓ ' + email.provider + ' — ' + email.detail
|
|
254
|
+
: '✗ NOT WORKING — ' + email.detail;
|
|
255
|
+
}
|
|
256
|
+
|
|
226
257
|
// Startup summary — the EFFECTIVE config (defaults resolved) so you can see what
|
|
227
258
|
// the service is actually running with. Secrets are masked, never printed.
|
|
228
|
-
function banner() {
|
|
259
|
+
function banner(email) {
|
|
229
260
|
var set = function (v) { return v ? '✓ set' : '✗ MISSING'; };
|
|
230
261
|
var rows = [
|
|
231
262
|
['port', process.env.AUTH_PORT || '19001'],
|
|
@@ -238,7 +269,7 @@ function banner() {
|
|
|
238
269
|
['slide tolerance', (process.env.AUTH_ACCESS_TOKEN_TOLERANCE_SECONDS || '0') + 's'],
|
|
239
270
|
['max sessions/user', process.env.AUTH_MAX_SESSIONS_PER_USER || '5'],
|
|
240
271
|
['redis', (process.env.REDIS_HOST || 'localhost') + ':' + (process.env.REDIS_PORT || '6379')],
|
|
241
|
-
['email',
|
|
272
|
+
['email', describeEmail(email)],
|
|
242
273
|
// Names the VARIABLE it resolved through, not just "set" — with a shared
|
|
243
274
|
// default and a per-service override, "which server am I on" is otherwise
|
|
244
275
|
// a guess.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xeplr/auth",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Pluggable authentication service: register, login, forgot/reset password, RBAC, multi-tenancy",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"multer": "^2.3.0",
|
|
45
45
|
"@xeplr/base-apis": "^2.0.0",
|
|
46
46
|
"@xeplr/db": "^1.0.0",
|
|
47
|
-
"@xeplr/utils": "^1.0.
|
|
47
|
+
"@xeplr/utils": "^1.0.8"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"express": "^4.0.0 || ^5.0.0"
|