hazo_auth 10.23.2 → 10.23.3
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/cli-src/lib/services/email_service.ts +5 -1
- package/cli-src/lib/services/email_verification_service.ts +1 -1
- package/cli-src/lib/services/otp_service.ts +1 -1
- package/cli-src/lib/services/password_change_service.ts +2 -2
- package/cli-src/lib/services/password_reset_service.ts +2 -2
- package/cli-src/lib/services/registration_service.ts +1 -1
- package/dist/lib/services/email_service.d.ts +3 -1
- package/dist/lib/services/email_service.d.ts.map +1 -1
- package/dist/lib/services/email_service.js +6 -9
- package/dist/lib/services/email_verification_service.js +1 -1
- package/dist/lib/services/otp_service.js +1 -1
- package/dist/lib/services/password_change_service.js +1 -1
- package/dist/lib/services/password_reset_service.js +2 -2
- package/dist/lib/services/registration_service.js +1 -1
- package/dist/server/routes/user_management_users.d.ts +1 -1
- package/package.json +6 -6
|
@@ -346,12 +346,15 @@ export async function send_email(options: EmailOptions): Promise<{ success: bool
|
|
|
346
346
|
* @param template_type - System template name (email_verification | forgot_password | password_changed)
|
|
347
347
|
* @param to - Recipient email address
|
|
348
348
|
* @param data - Template data; `token` is auto-expanded into verification_url/reset_url
|
|
349
|
+
* @param recipient_user_id - Optional hazo_users id of the recipient. Forwarded to hazo_notify so
|
|
350
|
+
* the template locale resolves from the user's `preferred_locale`. Omit when unknown.
|
|
349
351
|
* @returns Promise that resolves with success status
|
|
350
352
|
*/
|
|
351
353
|
export async function send_template_email(
|
|
352
354
|
template_type: EmailTemplateType,
|
|
353
355
|
to: string,
|
|
354
|
-
data: EmailTemplateData
|
|
356
|
+
data: EmailTemplateData,
|
|
357
|
+
recipient_user_id?: string
|
|
355
358
|
): Promise<{ success: boolean; error?: string }> {
|
|
356
359
|
const logger = create_app_logger();
|
|
357
360
|
|
|
@@ -407,6 +410,7 @@ export async function send_template_email(
|
|
|
407
410
|
subject,
|
|
408
411
|
from,
|
|
409
412
|
from_name,
|
|
413
|
+
...(recipient_user_id ? { recipient_user_id } : {}),
|
|
410
414
|
},
|
|
411
415
|
hazo_notify_connect
|
|
412
416
|
);
|
|
@@ -233,7 +233,7 @@ export async function resend_verification_email(
|
|
|
233
233
|
token: token_result.raw_token,
|
|
234
234
|
user_email: email,
|
|
235
235
|
user_name: user.name as string | undefined,
|
|
236
|
-
});
|
|
236
|
+
}, user_id);
|
|
237
237
|
|
|
238
238
|
if (!email_result.success) {
|
|
239
239
|
const logger = create_app_logger();
|
|
@@ -157,7 +157,7 @@ export async function request_email_otp(args: {
|
|
|
157
157
|
await send_template_email("otp_signin_code", email, {
|
|
158
158
|
otp_code: code,
|
|
159
159
|
expires_in_minutes: String(Math.round(cfg.code_ttl_seconds / 60)),
|
|
160
|
-
});
|
|
160
|
+
}, existing_user?.id ? String(existing_user.id) : undefined);
|
|
161
161
|
} catch (err) {
|
|
162
162
|
logger.error("otp_request_email_dispatch_failed", {
|
|
163
163
|
email,
|
|
@@ -98,8 +98,8 @@ export async function change_password(
|
|
|
98
98
|
const email_result = await send_template_email("password_changed", email, {
|
|
99
99
|
user_email: email,
|
|
100
100
|
user_name: user_name,
|
|
101
|
-
});
|
|
102
|
-
|
|
101
|
+
}, user_id);
|
|
102
|
+
|
|
103
103
|
if (!email_result.success) {
|
|
104
104
|
const logger = create_app_logger();
|
|
105
105
|
logger.error("password_change_service_email_failed", {
|
|
@@ -106,7 +106,7 @@ export async function request_password_reset(
|
|
|
106
106
|
token: token_result.raw_token,
|
|
107
107
|
user_email: email,
|
|
108
108
|
user_name: user.name as string | undefined,
|
|
109
|
-
});
|
|
109
|
+
}, user_id);
|
|
110
110
|
|
|
111
111
|
if (!email_result.success) {
|
|
112
112
|
const logger = create_app_logger();
|
|
@@ -386,7 +386,7 @@ export async function reset_password(
|
|
|
386
386
|
const email_result = await send_template_email("password_changed", email, {
|
|
387
387
|
user_email: email,
|
|
388
388
|
user_name: user.name as string | undefined,
|
|
389
|
-
});
|
|
389
|
+
}, user_id);
|
|
390
390
|
|
|
391
391
|
if (!email_result.success) {
|
|
392
392
|
const logger = create_app_logger();
|
|
@@ -48,9 +48,11 @@ export declare function send_email(options: EmailOptions): Promise<{
|
|
|
48
48
|
* @param template_type - System template name (email_verification | forgot_password | password_changed)
|
|
49
49
|
* @param to - Recipient email address
|
|
50
50
|
* @param data - Template data; `token` is auto-expanded into verification_url/reset_url
|
|
51
|
+
* @param recipient_user_id - Optional hazo_users id of the recipient. Forwarded to hazo_notify so
|
|
52
|
+
* the template locale resolves from the user's `preferred_locale`. Omit when unknown.
|
|
51
53
|
* @returns Promise that resolves with success status
|
|
52
54
|
*/
|
|
53
|
-
export declare function send_template_email(template_type: EmailTemplateType, to: string, data: EmailTemplateData): Promise<{
|
|
55
|
+
export declare function send_template_email(template_type: EmailTemplateType, to: string, data: EmailTemplateData, recipient_user_id?: string): Promise<{
|
|
54
56
|
success: boolean;
|
|
55
57
|
error?: string;
|
|
56
58
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email_service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/email_service.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAoB,MAAM,4BAA4B,CAAC;AAClF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAGxE,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,GAAG,oBAAoB,GAAG,kBAAkB,GAAG,iBAAiB,CAAC;AAElH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,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AE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACnC,CAAC;AAiBF;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAEpE;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,mBAAmB,GAAG,IAAI,CAE3E;AAmMD;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CA4ErG;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,mBAAmB,CACvC,aAAa,EAAE,iBAAiB,EAChC,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,iBAAiB,EACvB,iBAAiB,CAAC,EAAE,MAAM,GACzB,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CA6F/C"}
|
|
@@ -289,9 +289,11 @@ export async function send_email(options) {
|
|
|
289
289
|
* @param template_type - System template name (email_verification | forgot_password | password_changed)
|
|
290
290
|
* @param to - Recipient email address
|
|
291
291
|
* @param data - Template data; `token` is auto-expanded into verification_url/reset_url
|
|
292
|
+
* @param recipient_user_id - Optional hazo_users id of the recipient. Forwarded to hazo_notify so
|
|
293
|
+
* the template locale resolves from the user's `preferred_locale`. Omit when unknown.
|
|
292
294
|
* @returns Promise that resolves with success status
|
|
293
295
|
*/
|
|
294
|
-
export async function send_template_email(template_type, to, data) {
|
|
296
|
+
export async function send_template_email(template_type, to, data, recipient_user_id) {
|
|
295
297
|
const logger = create_app_logger();
|
|
296
298
|
// Emit a one-time deprecation warning if the old filesystem override key is set.
|
|
297
299
|
warn_if_template_directory_configured();
|
|
@@ -328,15 +330,10 @@ export async function send_template_email(template_type, to, data) {
|
|
|
328
330
|
const subject = get_email_subject(template_type);
|
|
329
331
|
// Dynamic import keeps hazo_notify optional at build time.
|
|
330
332
|
const { send_template_email: notify_send_template_email } = await import("hazo_notify/template_manager");
|
|
331
|
-
const result = await notify_send_template_email({
|
|
332
|
-
|
|
333
|
-
to,
|
|
334
|
-
variables,
|
|
335
|
-
scope_id: null,
|
|
336
|
-
subject,
|
|
333
|
+
const result = await notify_send_template_email(Object.assign({ template_name: template_type, to,
|
|
334
|
+
variables, scope_id: null, subject,
|
|
337
335
|
from,
|
|
338
|
-
from_name,
|
|
339
|
-
}, hazo_notify_connect);
|
|
336
|
+
from_name }, (recipient_user_id ? { recipient_user_id } : {})), hazo_notify_connect);
|
|
340
337
|
if (result.success) {
|
|
341
338
|
logger.info("email_sent_via_template", {
|
|
342
339
|
filename: "email_service.ts",
|
|
@@ -176,7 +176,7 @@ export async function resend_verification_email(adapter, data) {
|
|
|
176
176
|
token: token_result.raw_token,
|
|
177
177
|
user_email: email,
|
|
178
178
|
user_name: user.name,
|
|
179
|
-
});
|
|
179
|
+
}, user_id);
|
|
180
180
|
if (!email_result.success) {
|
|
181
181
|
const logger = create_app_logger();
|
|
182
182
|
logger.error("email_verification_service_email_send_failed", {
|
|
@@ -124,7 +124,7 @@ export async function request_email_otp(args) {
|
|
|
124
124
|
await send_template_email("otp_signin_code", email, {
|
|
125
125
|
otp_code: code,
|
|
126
126
|
expires_in_minutes: String(Math.round(cfg.code_ttl_seconds / 60)),
|
|
127
|
-
});
|
|
127
|
+
}, (existing_user === null || existing_user === void 0 ? void 0 : existing_user.id) ? String(existing_user.id) : undefined);
|
|
128
128
|
}
|
|
129
129
|
catch (err) {
|
|
130
130
|
logger.error("otp_request_email_dispatch_failed", {
|
|
@@ -70,7 +70,7 @@ export async function change_password(adapter, user_id, data) {
|
|
|
70
70
|
const email_result = await send_template_email("password_changed", email, {
|
|
71
71
|
user_email: email,
|
|
72
72
|
user_name: user_name,
|
|
73
|
-
});
|
|
73
|
+
}, user_id);
|
|
74
74
|
if (!email_result.success) {
|
|
75
75
|
const logger = create_app_logger();
|
|
76
76
|
logger.error("password_change_service_email_failed", {
|
|
@@ -57,7 +57,7 @@ export async function request_password_reset(adapter, data) {
|
|
|
57
57
|
token: token_result.raw_token,
|
|
58
58
|
user_email: email,
|
|
59
59
|
user_name: user.name,
|
|
60
|
-
});
|
|
60
|
+
}, user_id);
|
|
61
61
|
if (!email_result.success) {
|
|
62
62
|
const logger = create_app_logger();
|
|
63
63
|
logger.error("password_reset_service_email_send_failed", {
|
|
@@ -300,7 +300,7 @@ export async function reset_password(adapter, data) {
|
|
|
300
300
|
const email_result = await send_template_email("password_changed", email, {
|
|
301
301
|
user_email: email,
|
|
302
302
|
user_name: user.name,
|
|
303
|
-
});
|
|
303
|
+
}, user_id);
|
|
304
304
|
if (!email_result.success) {
|
|
305
305
|
const logger = create_app_logger();
|
|
306
306
|
logger.error("password_reset_service_password_changed_email_failed", {
|
|
@@ -126,7 +126,7 @@ export async function register_user(adapter, data) {
|
|
|
126
126
|
token: token_result.raw_token,
|
|
127
127
|
user_email: email,
|
|
128
128
|
user_name: name,
|
|
129
|
-
});
|
|
129
|
+
}, user_id);
|
|
130
130
|
if (!email_result.success) {
|
|
131
131
|
const logger = create_app_logger();
|
|
132
132
|
logger.error("registration_service_email_send_failed", {
|
|
@@ -26,7 +26,7 @@ export declare function GET(request: NextRequest): Promise<NextResponse<{
|
|
|
26
26
|
profile_source: {} | null;
|
|
27
27
|
user_type: string | null;
|
|
28
28
|
app_user_data: Record<string, unknown> | null;
|
|
29
|
-
legal_acceptance_status: "current" | "
|
|
29
|
+
legal_acceptance_status: "current" | "outdated" | "none";
|
|
30
30
|
}[];
|
|
31
31
|
}>>;
|
|
32
32
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hazo_auth",
|
|
3
|
-
"version": "10.23.
|
|
3
|
+
"version": "10.23.3",
|
|
4
4
|
"description": "Zero-config authentication UI components for Next.js with RBAC, OAuth, scope-based multi-tenancy, and invitations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"authentication",
|
|
@@ -278,12 +278,12 @@
|
|
|
278
278
|
"hazo_config": "^2.6.0",
|
|
279
279
|
"hazo_connect": "^4.3.1",
|
|
280
280
|
"hazo_core": "^2.4.0",
|
|
281
|
-
"hazo_i18n": "^0.
|
|
281
|
+
"hazo_i18n": "^0.8.1",
|
|
282
282
|
"hazo_logs": "^2.3.0",
|
|
283
|
-
"hazo_notify": "^6.6.
|
|
283
|
+
"hazo_notify": "^6.6.1",
|
|
284
284
|
"hazo_secure": "^1.8.1",
|
|
285
285
|
"hazo_theme": "^1.4.0",
|
|
286
|
-
"hazo_ui": "^6.
|
|
286
|
+
"hazo_ui": "^6.13.1",
|
|
287
287
|
"next": "^14.0.0 || ^15.0.0 || ^16.0.0",
|
|
288
288
|
"next-auth": "^4.24.0",
|
|
289
289
|
"react": "^18.0.0 || ^19.0.0",
|
|
@@ -366,9 +366,9 @@
|
|
|
366
366
|
"hazo_connect": "^4.3.1",
|
|
367
367
|
"hazo_core": "^2.4.0",
|
|
368
368
|
"hazo_logs": "^2.3.0",
|
|
369
|
-
"hazo_notify": "^6.6.
|
|
369
|
+
"hazo_notify": "^6.6.1",
|
|
370
370
|
"hazo_theme": "^1.4.0",
|
|
371
|
-
"hazo_ui": "^6.
|
|
371
|
+
"hazo_ui": "^6.13.1",
|
|
372
372
|
"input-otp": "^1.4.0",
|
|
373
373
|
"jest": "^30.2.0",
|
|
374
374
|
"jest-environment-jsdom": "^30.0.0",
|