hazo_auth 10.27.0 → 10.32.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/cli-src/lib/auth/auth_cache.ts +11 -1
- package/cli-src/lib/auth/hazo_get_auth.server.ts +65 -8
- package/cli-src/lib/auth/hazo_get_tenant_auth.server.ts +9 -45
- package/cli-src/lib/auth/scope_header.ts +58 -0
- package/cli-src/lib/auth_hooks.ts +19 -5
- package/cli-src/lib/email_verification_config.server.ts +3 -0
- package/cli-src/lib/forgot_password_config.server.ts +3 -0
- package/cli-src/lib/register_config.server.ts +3 -0
- package/cli-src/lib/reset_password_config.server.ts +3 -0
- package/cli-src/lib/schema/sqlite_schema.ts +150 -38
- package/cli-src/lib/services/index.ts +1 -0
- package/cli-src/lib/services/scope_membership_service.ts +68 -0
- package/cli-src/lib/services/scope_service.ts +21 -0
- package/cli-src/lib/services/user_scope_service.ts +4 -32
- package/dist/admin-issues/plugin.server.js +1 -1
- package/dist/components/layouts/email_verification/index.d.ts +3 -1
- package/dist/components/layouts/email_verification/index.d.ts.map +1 -1
- package/dist/components/layouts/email_verification/index.js +4 -4
- package/dist/components/layouts/forgot_password/index.d.ts +3 -1
- package/dist/components/layouts/forgot_password/index.d.ts.map +1 -1
- package/dist/components/layouts/forgot_password/index.js +2 -2
- package/dist/components/layouts/my_settings/hooks/use_my_settings.d.ts +8 -0
- package/dist/components/layouts/my_settings/hooks/use_my_settings.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/hooks/use_my_settings.js +37 -0
- package/dist/components/layouts/my_settings/index.d.ts +6 -1
- package/dist/components/layouts/my_settings/index.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/index.js +3 -3
- package/dist/components/layouts/register/hooks/use_register_form.d.ts +20 -1
- package/dist/components/layouts/register/hooks/use_register_form.d.ts.map +1 -1
- package/dist/components/layouts/register/hooks/use_register_form.js +70 -4
- package/dist/components/layouts/register/index.d.ts +13 -1
- package/dist/components/layouts/register/index.d.ts.map +1 -1
- package/dist/components/layouts/register/index.js +26 -4
- package/dist/components/layouts/reset_password/index.d.ts +3 -1
- package/dist/components/layouts/reset_password/index.d.ts.map +1 -1
- package/dist/components/layouts/reset_password/index.js +5 -5
- package/dist/components/layouts/shared/hooks/use_auth_status.d.ts +3 -0
- package/dist/components/layouts/shared/hooks/use_auth_status.d.ts.map +1 -1
- package/dist/components/layouts/shared/hooks/use_auth_status.js +5 -2
- package/dist/components/layouts/user_management/components/user_signup_stats_cards.d.ts +1 -8
- package/dist/components/layouts/user_management/components/user_signup_stats_cards.d.ts.map +1 -1
- package/dist/components/layouts/user_management/components/user_signup_stats_cards.js +8 -90
- package/dist/components/ui/alert-dialog.d.ts +9 -9
- package/dist/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/components/ui/avatar.d.ts +4 -3
- package/dist/components/ui/avatar.d.ts.map +1 -1
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/checkbox.d.ts +2 -1
- package/dist/components/ui/checkbox.d.ts.map +1 -1
- package/dist/components/ui/dialog.d.ts +8 -8
- package/dist/components/ui/dialog.d.ts.map +1 -1
- package/dist/components/ui/dropdown-menu.d.ts +17 -17
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/components/ui/hover-card.d.ts +3 -3
- package/dist/components/ui/hover-card.d.ts.map +1 -1
- package/dist/components/ui/input-otp.d.ts +27 -1
- package/dist/components/ui/input-otp.d.ts.map +1 -1
- package/dist/components/ui/label.d.ts +2 -1
- package/dist/components/ui/label.d.ts.map +1 -1
- package/dist/components/ui/select.d.ts +10 -10
- package/dist/components/ui/select.d.ts.map +1 -1
- package/dist/components/ui/separator.d.ts +2 -1
- package/dist/components/ui/separator.d.ts.map +1 -1
- package/dist/components/ui/sheet.d.ts +9 -9
- package/dist/components/ui/sheet.d.ts.map +1 -1
- package/dist/components/ui/sidebar.d.ts +1 -1
- package/dist/components/ui/sidebar.d.ts.map +1 -1
- package/dist/components/ui/switch.d.ts +2 -1
- package/dist/components/ui/switch.d.ts.map +1 -1
- package/dist/components/ui/tabs.d.ts +4 -4
- package/dist/components/ui/tabs.d.ts.map +1 -1
- package/dist/components/ui/tooltip.d.ts +4 -4
- package/dist/components/ui/tooltip.d.ts.map +1 -1
- package/dist/components/ui/tree-view.d.ts +2 -1
- package/dist/components/ui/tree-view.d.ts.map +1 -1
- package/dist/components/ui/vertical-tabs.d.ts +4 -4
- package/dist/components/ui/vertical-tabs.d.ts.map +1 -1
- package/dist/lib/auth/auth_cache.d.ts +6 -2
- package/dist/lib/auth/auth_cache.d.ts.map +1 -1
- package/dist/lib/auth/auth_cache.js +6 -2
- package/dist/lib/auth/auth_types.d.ts +4 -0
- package/dist/lib/auth/auth_types.d.ts.map +1 -1
- package/dist/lib/auth/hazo_get_auth.server.d.ts.map +1 -1
- package/dist/lib/auth/hazo_get_auth.server.js +64 -8
- package/dist/lib/auth/hazo_get_tenant_auth.server.d.ts +2 -18
- package/dist/lib/auth/hazo_get_tenant_auth.server.d.ts.map +1 -1
- package/dist/lib/auth/hazo_get_tenant_auth.server.js +5 -38
- package/dist/lib/auth/scope_header.d.ts +28 -0
- package/dist/lib/auth/scope_header.d.ts.map +1 -0
- package/dist/lib/auth/scope_header.js +34 -0
- package/dist/lib/auth_hooks.d.ts.map +1 -1
- package/dist/lib/auth_hooks.js +19 -5
- package/dist/lib/email_verification_config.server.d.ts +2 -0
- package/dist/lib/email_verification_config.server.d.ts.map +1 -1
- package/dist/lib/email_verification_config.server.js +1 -0
- package/dist/lib/forgot_password_config.server.d.ts +2 -0
- package/dist/lib/forgot_password_config.server.d.ts.map +1 -1
- package/dist/lib/forgot_password_config.server.js +1 -0
- package/dist/lib/my_settings_config.server.d.ts +4 -0
- package/dist/lib/my_settings_config.server.d.ts.map +1 -1
- package/dist/lib/my_settings_config.server.js +3 -0
- package/dist/lib/register_config.server.d.ts +12 -0
- package/dist/lib/register_config.server.d.ts.map +1 -1
- package/dist/lib/register_config.server.js +8 -0
- package/dist/lib/reset_password_config.server.d.ts +2 -0
- package/dist/lib/reset_password_config.server.d.ts.map +1 -1
- package/dist/lib/reset_password_config.server.js +1 -0
- package/dist/lib/schema/sqlite_schema.d.ts +1 -1
- package/dist/lib/schema/sqlite_schema.d.ts.map +1 -1
- package/dist/lib/schema/sqlite_schema.js +150 -38
- package/dist/lib/services/index.d.ts +1 -0
- package/dist/lib/services/index.d.ts.map +1 -1
- package/dist/lib/services/index.js +1 -0
- package/dist/lib/services/registration_service.js +30 -5
- package/dist/lib/services/scope_membership_service.d.ts +20 -0
- package/dist/lib/services/scope_membership_service.d.ts.map +1 -0
- package/dist/lib/services/scope_membership_service.js +49 -0
- package/dist/lib/services/scope_service.d.ts +6 -0
- package/dist/lib/services/scope_service.d.ts.map +1 -1
- package/dist/lib/services/scope_service.js +12 -0
- package/dist/lib/services/user_scope_service.d.ts.map +1 -1
- package/dist/lib/services/user_scope_service.js +4 -30
- package/dist/lib/services/user_update_service.d.ts +5 -0
- package/dist/lib/services/user_update_service.d.ts.map +1 -1
- package/dist/lib/services/user_update_service.js +2 -0
- package/dist/locales/en.json +10 -0
- package/dist/page_components/my_settings.d.ts +9 -1
- package/dist/page_components/my_settings.d.ts.map +1 -1
- package/dist/page_components/my_settings.js +8 -2
- package/dist/server/routes/detect_proxy_origin.d.ts +6 -0
- package/dist/server/routes/detect_proxy_origin.d.ts.map +1 -0
- package/dist/server/routes/detect_proxy_origin.js +49 -0
- package/dist/server/routes/me.d.ts.map +1 -1
- package/dist/server/routes/me.js +5 -1
- package/dist/server/routes/nextauth.d.ts.map +1 -1
- package/dist/server/routes/nextauth.js +1 -44
- package/dist/server/routes/register.js +53 -2
- package/dist/server/routes/update_user.d.ts.map +1 -1
- package/dist/server/routes/update_user.js +24 -1
- package/dist/server/routes/user_management_users.d.ts +1 -1
- package/dist/server_pages/forgot_password.d.ts.map +1 -1
- package/dist/server_pages/forgot_password.js +1 -1
- package/dist/server_pages/forgot_password_client_wrapper.d.ts +1 -1
- package/dist/server_pages/forgot_password_client_wrapper.d.ts.map +1 -1
- package/dist/server_pages/forgot_password_client_wrapper.js +2 -2
- package/dist/server_pages/my_settings.d.ts.map +1 -1
- package/dist/server_pages/my_settings.js +1 -1
- package/dist/server_pages/register.d.ts +19 -1
- package/dist/server_pages/register.d.ts.map +1 -1
- package/dist/server_pages/register.js +4 -4
- package/dist/server_pages/register_client_wrapper.d.ts +6 -2
- package/dist/server_pages/register_client_wrapper.d.ts.map +1 -1
- package/dist/server_pages/register_client_wrapper.js +2 -2
- package/dist/server_pages/reset_password.d.ts.map +1 -1
- package/dist/server_pages/reset_password.js +1 -1
- package/dist/server_pages/reset_password_client_wrapper.d.ts +1 -1
- package/dist/server_pages/reset_password_client_wrapper.d.ts.map +1 -1
- package/dist/server_pages/reset_password_client_wrapper.js +2 -2
- package/dist/server_pages/verify_email.d.ts.map +1 -1
- package/dist/server_pages/verify_email.js +1 -1
- package/dist/server_pages/verify_email_client_wrapper.d.ts +1 -1
- package/dist/server_pages/verify_email_client_wrapper.d.ts.map +1 -1
- package/dist/server_pages/verify_email_client_wrapper.js +2 -2
- package/dist/settings/index.d.ts +5 -0
- package/dist/settings/index.d.ts.map +1 -0
- package/dist/settings/index.js +161 -0
- package/package.json +15 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope_service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/scope_service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAM/C;;;GAGG;AACH,eAAO,MAAM,uBAAuB,yCAAyC,CAAC;AAI9E;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,GAAG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GG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,kBAAkB,EAC3B,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,kBAAkB,CAAC,CAgD7B;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,kBAAkB,EAC3B,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,kBAAkB,CAAC,CAyC7B;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,kBAAkB,EAC3B,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAuBxB;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,kBAAkB,EAC3B,aAAa,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,aAAa,EAAE,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAoEvE;AAED;;GAEG;AACH,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,kBAAkB,CAAC,CA0D7B"}
|
|
@@ -33,6 +33,8 @@ function normalize_scope_record(raw) {
|
|
|
33
33
|
return null;
|
|
34
34
|
}
|
|
35
35
|
})(),
|
|
36
|
+
timezone: raw.timezone || null,
|
|
37
|
+
locale: raw.locale || null,
|
|
36
38
|
created_at: raw.created_at,
|
|
37
39
|
changed_at: raw.changed_at,
|
|
38
40
|
};
|
|
@@ -226,6 +228,8 @@ export async function create_scope(adapter, data) {
|
|
|
226
228
|
tagline: data.tagline || null,
|
|
227
229
|
app_title: data.app_title || null,
|
|
228
230
|
footer_config: data.footer ? JSON.stringify(data.footer) : null,
|
|
231
|
+
timezone: data.timezone || null,
|
|
232
|
+
locale: data.locale || null,
|
|
229
233
|
created_at: now,
|
|
230
234
|
changed_at: now,
|
|
231
235
|
};
|
|
@@ -337,6 +341,12 @@ export async function update_scope(adapter, scope_id, data) {
|
|
|
337
341
|
if (data.footer !== undefined) {
|
|
338
342
|
update_data.footer_config = data.footer ? JSON.stringify(data.footer) : null;
|
|
339
343
|
}
|
|
344
|
+
if (data.timezone !== undefined) {
|
|
345
|
+
update_data.timezone = data.timezone;
|
|
346
|
+
}
|
|
347
|
+
if (data.locale !== undefined) {
|
|
348
|
+
update_data.locale = data.locale;
|
|
349
|
+
}
|
|
340
350
|
const updated = await scope_service.updateById(scope_id, update_data);
|
|
341
351
|
if (!Array.isArray(updated) || updated.length === 0) {
|
|
342
352
|
return {
|
|
@@ -642,6 +652,8 @@ export async function ensure_default_system_scope(adapter) {
|
|
|
642
652
|
tagline: null,
|
|
643
653
|
app_title: null,
|
|
644
654
|
footer_config: null,
|
|
655
|
+
timezone: null,
|
|
656
|
+
locale: null,
|
|
645
657
|
created_at: now,
|
|
646
658
|
changed_at: now,
|
|
647
659
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user_scope_service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/user_scope_service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAuBvD,MAAM,MAAM,SAAS,GAAG;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE;QACX,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,WAAW,CAAC,EAAE,SAAS,EAAE,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAIF;;GAEG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,kBAAkB,EAC3B,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,eAAe,CAAC,CA4B1B;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,kBAAkB,EAC3B,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,eAAe,CAAC,CA4B1B;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,kBAAkB,EAC3B,IAAI,EAAE,mBAAmB,GACxB,OAAO,CAAC,eAAe,CAAC,CA2E1B;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,kBAAkB,EAC3B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,eAAe,CAAC,
|
|
1
|
+
{"version":3,"file":"user_scope_service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/user_scope_service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAuBvD,MAAM,MAAM,SAAS,GAAG;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,O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AA;CAAE,CAAC,GACvD,OAAO,CAAC,eAAe,CAAC,CAwD1B;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,kBAAkB,EAC3B,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,OAAO,CAAC,CAWlB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,kBAAkB,EAC3B,OAAO,EAAE,MAAM,EACf,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,sBAAsB,CAAC,CAoEjC;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,kBAAkB,EAC3B,OAAO,EAAE,MAAM,GACd,OAAO,CAAC;IACT,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,KAAK,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC,CAAC;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC,CA4CD"}
|
|
@@ -163,36 +163,10 @@ export async function remove_user_scope(adapter, user_id, scope_id) {
|
|
|
163
163
|
};
|
|
164
164
|
}
|
|
165
165
|
const existing_scope = existing[0];
|
|
166
|
-
//
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
await user_scope_service.deleteById(existing[0].id);
|
|
171
|
-
}
|
|
172
|
-
else {
|
|
173
|
-
// For composite keys, we need to find and delete by all criteria
|
|
174
|
-
const all_user_scopes = await user_scope_service.findBy({ user_id });
|
|
175
|
-
if (Array.isArray(all_user_scopes)) {
|
|
176
|
-
for (const scope of all_user_scopes) {
|
|
177
|
-
const s = scope;
|
|
178
|
-
if (s.scope_id === scope_id) {
|
|
179
|
-
if (scope.id) {
|
|
180
|
-
await user_scope_service.deleteById(scope.id);
|
|
181
|
-
}
|
|
182
|
-
break;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
catch (_a) {
|
|
189
|
-
const logger = create_app_logger();
|
|
190
|
-
logger.warn("user_scope_delete_fallback", {
|
|
191
|
-
filename: "user_scope_service.ts",
|
|
192
|
-
line_number: 0,
|
|
193
|
-
note: "Delete by composite key not fully supported",
|
|
194
|
-
});
|
|
195
|
-
}
|
|
166
|
+
// hazo_user_scopes has no `id` column — it uses a composite primary key
|
|
167
|
+
// (user_id, scope_id) — so delete by that composite key directly rather
|
|
168
|
+
// than through the single-key deleteById path.
|
|
169
|
+
await user_scope_service.deleteWhere({ user_id, scope_id });
|
|
196
170
|
return {
|
|
197
171
|
success: true,
|
|
198
172
|
scope: existing_scope,
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import type { HazoConnectAdapter } from "hazo_connect";
|
|
2
2
|
import { type ProfilePictureSourceUI } from "./profile_picture_source_mapper.js";
|
|
3
|
+
import { type LocationFieldsInput } from "./location_fields_helper.js";
|
|
3
4
|
export type UserUpdateData = {
|
|
4
5
|
name?: string;
|
|
5
6
|
email?: string;
|
|
6
7
|
profile_picture_url?: string;
|
|
7
8
|
profile_source?: ProfilePictureSourceUI;
|
|
8
9
|
preferred_locale?: string | null;
|
|
10
|
+
/** Indexed location columns (My Settings' "Location" card). Only non-blank,
|
|
11
|
+
* provided fields are persisted — omitted or blank fields are left unchanged
|
|
12
|
+
* (see build_location_fields; it has no "clear" semantics). */
|
|
13
|
+
location?: LocationFieldsInput;
|
|
9
14
|
};
|
|
10
15
|
export type UserUpdateResult = {
|
|
11
16
|
success: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user_update_service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/user_update_service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EAAuB,KAAK,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"user_update_service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/user_update_service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EAAuB,KAAK,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAInG,OAAO,EAAyB,KAAK,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAG3F,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,cAAc,CAAC,EAAE,sBAAsB,CAAC;IAIxC,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC;;oEAEgE;IAChE,QAAQ,CAAC,EAAE,mBAAmB,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAGF;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,kBAAkB,EAC3B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,gBAAgB,CAAC,CA8G3B"}
|
|
@@ -3,6 +3,7 @@ import { map_ui_source_to_db } from "./profile_picture_source_mapper.js";
|
|
|
3
3
|
import { create_app_logger } from "../app_logger.js";
|
|
4
4
|
import { sanitize_error_for_user } from "../utils/error_sanitizer.js";
|
|
5
5
|
import { get_line_number } from "../utils/api_route_helpers.js";
|
|
6
|
+
import { build_location_fields } from "./location_fields_helper.js";
|
|
6
7
|
// section: helpers
|
|
7
8
|
/**
|
|
8
9
|
* Updates user profile information (name, email)
|
|
@@ -75,6 +76,7 @@ export async function update_user_profile(adapter, user_id, data) {
|
|
|
75
76
|
// null explicitly clears the preference (falls back to detection elsewhere)
|
|
76
77
|
update_data.preferred_locale = data.preferred_locale;
|
|
77
78
|
}
|
|
79
|
+
Object.assign(update_data, build_location_fields(data.location));
|
|
78
80
|
// If email changed, set email_verified to false
|
|
79
81
|
if (email_changed) {
|
|
80
82
|
update_data.email_verified = false;
|
package/dist/locales/en.json
CHANGED
|
@@ -162,6 +162,9 @@
|
|
|
162
162
|
"register.field.name.label": "Full name",
|
|
163
163
|
"register.field.name.placeholder": "Enter your full name",
|
|
164
164
|
"register.field.name.aria_label": "Full name input field",
|
|
165
|
+
"register.field.location_country.label": "Country",
|
|
166
|
+
"register.field.location_state_province.label": "State / Province",
|
|
167
|
+
"register.field.location_suburb.label": "Suburb",
|
|
165
168
|
"register.field.password.label": "Password",
|
|
166
169
|
"register.field.password.placeholder": "Enter your password",
|
|
167
170
|
"register.field.password.aria_label": "Password input field",
|
|
@@ -591,6 +594,7 @@
|
|
|
591
594
|
"app_user_data.clear_dialog.confirming": "Clearing...",
|
|
592
595
|
"user_management.signup_stats.vs_previous": "vs. previous equal period",
|
|
593
596
|
"user_management.signup_stats.prev_count": "prev {{count}}",
|
|
597
|
+
"user_management.signup_stats.prev_template": "prev {count}",
|
|
594
598
|
"user_management.signup_stats.total_users": "total users",
|
|
595
599
|
"user_management.signup_stats.ytd_title": "Signups by month (YTD)",
|
|
596
600
|
"user_management.signup_stats.ytd_aria": "Year-to-date signups by month: {{list}}",
|
|
@@ -608,6 +612,12 @@
|
|
|
608
612
|
"my_settings.toast.password_error": "Failed to change password",
|
|
609
613
|
"my_settings.toast.profile_picture_success": "Profile picture updated successfully",
|
|
610
614
|
"my_settings.toast.profile_picture_error": "Failed to update profile picture",
|
|
615
|
+
"my_settings.toast.location_success": "Location updated successfully",
|
|
616
|
+
"my_settings.toast.location_error": "Failed to update location",
|
|
617
|
+
"my_settings.location_label_default": "Location",
|
|
618
|
+
"my_settings.location.country_label": "Country",
|
|
619
|
+
"my_settings.location.state_province_label": "State / Province",
|
|
620
|
+
"my_settings.location.suburb_label": "Suburb",
|
|
611
621
|
"my_settings.toast.profile_picture_removed": "Profile picture removed successfully",
|
|
612
622
|
"my_settings.toast.profile_picture_remove_error": "Failed to remove profile picture",
|
|
613
623
|
"user_management.table.photo": "Photo",
|
|
@@ -21,6 +21,14 @@ export type MySettingsPageProps = {
|
|
|
21
21
|
show_email_field?: boolean;
|
|
22
22
|
show_password_field?: boolean;
|
|
23
23
|
};
|
|
24
|
+
/** Which indexed location fields to show as an editable "Location" card.
|
|
25
|
+
* All default to false — this manual-config entry point has no INI file to
|
|
26
|
+
* read, unlike the zero-config `server_pages/my_settings.tsx`. */
|
|
27
|
+
locationFields?: {
|
|
28
|
+
country?: boolean;
|
|
29
|
+
state_province?: boolean;
|
|
30
|
+
suburb?: boolean;
|
|
31
|
+
};
|
|
24
32
|
passwordRequirements?: Partial<PasswordRequirementOptions>;
|
|
25
33
|
profilePicture?: {
|
|
26
34
|
allow_photo_upload?: boolean;
|
|
@@ -64,6 +72,6 @@ export type MySettingsPageProps = {
|
|
|
64
72
|
* @param props - Optional configuration overrides
|
|
65
73
|
* @returns My settings page component
|
|
66
74
|
*/
|
|
67
|
-
export declare function MySettingsPage({ userFields, passwordRequirements, profilePicture, heading: headingProp, subHeading: subHeadingProp, profilePhotoLabel: profilePhotoLabelProp, profilePhotoRecommendation, uploadPhotoButtonLabel: uploadPhotoButtonLabelProp, removePhotoButtonLabel: removePhotoButtonLabelProp, profileInformationLabel: profileInformationLabelProp, passwordLabel: passwordLabelProp, currentPasswordLabel: currentPasswordLabelProp, newPasswordLabel: newPasswordLabelProp, confirmPasswordLabel: confirmPasswordLabelProp, savePasswordButtonLabel, unauthorizedMessage: unauthorizedMessageProp, loginButtonLabel: loginButtonLabelProp, loginPath, enableAccountDeletion, messages, uiSizes, fileTypes, }?: MySettingsPageProps): import("react").JSX.Element;
|
|
75
|
+
export declare function MySettingsPage({ userFields, locationFields, passwordRequirements, profilePicture, heading: headingProp, subHeading: subHeadingProp, profilePhotoLabel: profilePhotoLabelProp, profilePhotoRecommendation, uploadPhotoButtonLabel: uploadPhotoButtonLabelProp, removePhotoButtonLabel: removePhotoButtonLabelProp, profileInformationLabel: profileInformationLabelProp, passwordLabel: passwordLabelProp, currentPasswordLabel: currentPasswordLabelProp, newPasswordLabel: newPasswordLabelProp, confirmPasswordLabel: confirmPasswordLabelProp, savePasswordButtonLabel, unauthorizedMessage: unauthorizedMessageProp, loginButtonLabel: loginButtonLabelProp, loginPath, enableAccountDeletion, messages, uiSizes, fileTypes, }?: MySettingsPageProps): import("react").JSX.Element;
|
|
68
76
|
export default MySettingsPage;
|
|
69
77
|
//# sourceMappingURL=my_settings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"my_settings.d.ts","sourceRoot":"","sources":["../../src/page_components/my_settings.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0DAA0D,CAAC;
|
|
1
|
+
{"version":3,"file":"my_settings.d.ts","sourceRoot":"","sources":["../../src/page_components/my_settings.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0DAA0D,CAAC;AAkC3G,QAAA,MAAM,gBAAgB;;;;;CAKrB,CAAC;AAEF,QAAA,MAAM,gBAAgB;;;;;;;;;CASrB,CAAC;AAQF,MAAM,MAAM,mBAAmB,GAAG;IAChC,UAAU,CAAC,EAAE;QACX,eAAe,CAAC,EAAE,OAAO,CAAC;QAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;QAC3B,mBAAmB,CAAC,EAAE,OAAO,CAAC;KAC/B,CAAC;IACF;;uEAEmE;IACnE,cAAc,CAAC,EAAE;QACf,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,MAAM,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;IACF,oBAAoB,CAAC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CAAC;KACrC,CAAC;CACH,CAAC;AAGF;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAC7B,UAAU,EACV,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,cAAc,EAC1B,iBAAiB,EAAE,qBAAqB,EACxC,0BAAiF,EACjF,sBAAsB,EAAE,0BAA0B,EAClD,sBAAsB,EAAE,0BAA0B,EAClD,uBAAuB,EAAE,2BAA2B,EACpD,aAAa,EAAE,iBAAiB,EAChC,oBAAoB,EAAE,wBAAwB,EAC9C,gBAAgB,EAAE,oBAAoB,EACtC,oBAAoB,EAAE,wBAAwB,EAC9C,uBAA2C,EAC3C,mBAAmB,EAAE,uBAAuB,EAC5C,gBAAgB,EAAE,oBAAoB,EACtC,SAA8B,EAC9B,qBAA6B,EAC7B,QAAQ,EACR,OAAO,EACP,SAAS,GACV,GAAE,mBAAwB,+BA+E1B;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -11,6 +11,11 @@ const DEFAULT_USER_FIELDS = {
|
|
|
11
11
|
show_email_field: true,
|
|
12
12
|
show_password_field: true,
|
|
13
13
|
};
|
|
14
|
+
const DEFAULT_LOCATION_FIELDS = {
|
|
15
|
+
country: false,
|
|
16
|
+
state_province: false,
|
|
17
|
+
suburb: false,
|
|
18
|
+
};
|
|
14
19
|
const DEFAULT_PASSWORD_REQUIREMENTS = {
|
|
15
20
|
minimum_length: 8,
|
|
16
21
|
require_uppercase: true,
|
|
@@ -54,7 +59,7 @@ const DEFAULT_FILE_TYPES = {
|
|
|
54
59
|
* @param props - Optional configuration overrides
|
|
55
60
|
* @returns My settings page component
|
|
56
61
|
*/
|
|
57
|
-
export function MySettingsPage({ userFields, passwordRequirements, profilePicture, heading: headingProp, subHeading: subHeadingProp, profilePhotoLabel: profilePhotoLabelProp, profilePhotoRecommendation = "Recommended: Square image, at least 200x200 pixels", uploadPhotoButtonLabel: uploadPhotoButtonLabelProp, removePhotoButtonLabel: removePhotoButtonLabelProp, profileInformationLabel: profileInformationLabelProp, passwordLabel: passwordLabelProp, currentPasswordLabel: currentPasswordLabelProp, newPasswordLabel: newPasswordLabelProp, confirmPasswordLabel: confirmPasswordLabelProp, savePasswordButtonLabel = "Update Password", unauthorizedMessage: unauthorizedMessageProp, loginButtonLabel: loginButtonLabelProp, loginPath = "/hazo_auth/login", enableAccountDeletion = false, messages, uiSizes, fileTypes, } = {}) {
|
|
62
|
+
export function MySettingsPage({ userFields, locationFields, passwordRequirements, profilePicture, heading: headingProp, subHeading: subHeadingProp, profilePhotoLabel: profilePhotoLabelProp, profilePhotoRecommendation = "Recommended: Square image, at least 200x200 pixels", uploadPhotoButtonLabel: uploadPhotoButtonLabelProp, removePhotoButtonLabel: removePhotoButtonLabelProp, profileInformationLabel: profileInformationLabelProp, passwordLabel: passwordLabelProp, currentPasswordLabel: currentPasswordLabelProp, newPasswordLabel: newPasswordLabelProp, confirmPasswordLabel: confirmPasswordLabelProp, savePasswordButtonLabel = "Update Password", unauthorizedMessage: unauthorizedMessageProp, loginButtonLabel: loginButtonLabelProp, loginPath = "/hazo_auth/login", enableAccountDeletion = false, messages, uiSizes, fileTypes, } = {}) {
|
|
58
63
|
const t = useAuthT();
|
|
59
64
|
const heading = headingProp !== null && headingProp !== void 0 ? headingProp : t("my_settings.page_title");
|
|
60
65
|
const subHeading = subHeadingProp !== null && subHeadingProp !== void 0 ? subHeadingProp : t("my_settings.sub_heading_default");
|
|
@@ -70,12 +75,13 @@ export function MySettingsPage({ userFields, passwordRequirements, profilePictur
|
|
|
70
75
|
const loginButtonLabel = loginButtonLabelProp !== null && loginButtonLabelProp !== void 0 ? loginButtonLabelProp : t("shared.guard.login_button_default");
|
|
71
76
|
// Merge provided props with defaults
|
|
72
77
|
const mergedUserFields = Object.assign(Object.assign({}, DEFAULT_USER_FIELDS), userFields);
|
|
78
|
+
const mergedLocationFields = Object.assign(Object.assign({}, DEFAULT_LOCATION_FIELDS), locationFields);
|
|
73
79
|
const mergedPasswordRequirements = Object.assign(Object.assign({}, DEFAULT_PASSWORD_REQUIREMENTS), passwordRequirements);
|
|
74
80
|
const mergedProfilePicture = Object.assign(Object.assign({}, DEFAULT_PROFILE_PICTURE), profilePicture);
|
|
75
81
|
const mergedMessages = Object.assign(Object.assign({}, DEFAULT_MESSAGES), messages);
|
|
76
82
|
const mergedUiSizes = Object.assign(Object.assign({}, DEFAULT_UI_SIZES), uiSizes);
|
|
77
83
|
const mergedFileTypes = Object.assign(Object.assign({}, DEFAULT_FILE_TYPES), fileTypes);
|
|
78
84
|
const MySettingsLayout = my_settings_layout;
|
|
79
|
-
return (_jsx(MySettingsLayout, { userFields: mergedUserFields, password_requirements: mergedPasswordRequirements, profilePicture: mergedProfilePicture, heading: heading, subHeading: subHeading, profilePhotoLabel: profilePhotoLabel, profilePhotoRecommendation: profilePhotoRecommendation, uploadPhotoButtonLabel: uploadPhotoButtonLabel, removePhotoButtonLabel: removePhotoButtonLabel, profileInformationLabel: profileInformationLabel, passwordLabel: passwordLabel, currentPasswordLabel: currentPasswordLabel, newPasswordLabel: newPasswordLabel, confirmPasswordLabel: confirmPasswordLabel, unauthorizedMessage: unauthorizedMessage, loginButtonLabel: loginButtonLabel, loginPath: loginPath, enableAccountDeletion: enableAccountDeletion, messages: mergedMessages, uiSizes: mergedUiSizes, fileTypes: mergedFileTypes }));
|
|
85
|
+
return (_jsx(MySettingsLayout, { userFields: mergedUserFields, locationFields: mergedLocationFields, password_requirements: mergedPasswordRequirements, profilePicture: mergedProfilePicture, heading: heading, subHeading: subHeading, profilePhotoLabel: profilePhotoLabel, profilePhotoRecommendation: profilePhotoRecommendation, uploadPhotoButtonLabel: uploadPhotoButtonLabel, removePhotoButtonLabel: removePhotoButtonLabel, profileInformationLabel: profileInformationLabel, passwordLabel: passwordLabel, currentPasswordLabel: currentPasswordLabel, newPasswordLabel: newPasswordLabel, confirmPasswordLabel: confirmPasswordLabel, unauthorizedMessage: unauthorizedMessage, loginButtonLabel: loginButtonLabel, loginPath: loginPath, enableAccountDeletion: enableAccountDeletion, messages: mergedMessages, uiSizes: mergedUiSizes, fileTypes: mergedFileTypes }));
|
|
80
86
|
}
|
|
81
87
|
export default MySettingsPage;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detects the public-facing origin from request headers.
|
|
3
|
+
* Cloudflare tunnel sends: x-forwarded-host, x-forwarded-proto, cf-visitor, host
|
|
4
|
+
*/
|
|
5
|
+
export declare function detect_proxy_origin(request: Request): string | null;
|
|
6
|
+
//# sourceMappingURL=detect_proxy_origin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect_proxy_origin.d.ts","sourceRoot":"","sources":["../../../src/server/routes/detect_proxy_origin.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CA6CnE"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// file_description: public-facing origin detection for requests behind a reverse proxy/tunnel
|
|
2
|
+
// section: proxy_detection
|
|
3
|
+
/**
|
|
4
|
+
* Detects the public-facing origin from request headers.
|
|
5
|
+
* Cloudflare tunnel sends: x-forwarded-host, x-forwarded-proto, cf-visitor, host
|
|
6
|
+
*/
|
|
7
|
+
export function detect_proxy_origin(request) {
|
|
8
|
+
try {
|
|
9
|
+
const request_url = new URL(request.url);
|
|
10
|
+
const forwarded_host = request.headers.get("x-forwarded-host");
|
|
11
|
+
const host_header = request.headers.get("host");
|
|
12
|
+
const forwarded_proto = request.headers.get("x-forwarded-proto") || "https";
|
|
13
|
+
// Debug logging in development
|
|
14
|
+
if (process.env.NODE_ENV === "development") {
|
|
15
|
+
console.log("[NextAuth Proxy] request.url:", request.url);
|
|
16
|
+
console.log("[NextAuth Proxy] request_url.hostname:", request_url.hostname, "request_url.host:", request_url.host);
|
|
17
|
+
console.log("[NextAuth Proxy] x-forwarded-host:", forwarded_host);
|
|
18
|
+
console.log("[NextAuth Proxy] host header:", host_header);
|
|
19
|
+
console.log("[NextAuth Proxy] x-forwarded-proto:", forwarded_proto);
|
|
20
|
+
}
|
|
21
|
+
// Check x-forwarded-host first (set by Cloudflare tunnel, nginx, etc.)
|
|
22
|
+
// Compared against request_url.host (host:port), not .hostname (host only) —
|
|
23
|
+
// Next.js's own dev server sets x-forwarded-host to "host:port" on every
|
|
24
|
+
// request, which never matches a bare hostname and used to false-positive
|
|
25
|
+
// as a proxy on plain localhost dev, corrupting NEXTAUTH_URL.
|
|
26
|
+
if (forwarded_host && forwarded_host !== request_url.host) {
|
|
27
|
+
const origin = `${forwarded_proto}://${forwarded_host}`;
|
|
28
|
+
if (process.env.NODE_ENV === "development") {
|
|
29
|
+
console.log("[NextAuth Proxy] Detected proxy via x-forwarded-host:", origin);
|
|
30
|
+
}
|
|
31
|
+
return origin;
|
|
32
|
+
}
|
|
33
|
+
// Check host header (Cloudflare tunnel also sets this to the tunnel domain)
|
|
34
|
+
if (host_header && host_header !== request_url.host) {
|
|
35
|
+
const origin = `${forwarded_proto}://${host_header}`;
|
|
36
|
+
if (process.env.NODE_ENV === "development") {
|
|
37
|
+
console.log("[NextAuth Proxy] Detected proxy via host header:", origin);
|
|
38
|
+
}
|
|
39
|
+
return origin;
|
|
40
|
+
}
|
|
41
|
+
if (process.env.NODE_ENV === "development") {
|
|
42
|
+
console.log("[NextAuth Proxy] No proxy detected");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
catch (e) {
|
|
46
|
+
console.error("[NextAuth Proxy] Error:", e);
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"me.d.ts","sourceRoot":"","sources":["../../../src/server/routes/me.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAoBxD;;;;;GAKG;AACH,wBAAsB,GAAG,CAAC,OAAO,EAAE,WAAW;;
|
|
1
|
+
{"version":3,"file":"me.d.ts","sourceRoot":"","sources":["../../../src/server/routes/me.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAoBxD;;;;;GAKG;AACH,wBAAsB,GAAG,CAAC,OAAO,EAAE,WAAW;;IAuH7C"}
|
package/dist/server/routes/me.js
CHANGED
|
@@ -24,7 +24,7 @@ function strip_sentinel_email(email) {
|
|
|
24
24
|
* Always returns the same format to prevent downstream variations.
|
|
25
25
|
*/
|
|
26
26
|
export async function GET(request) {
|
|
27
|
-
var _a, _b;
|
|
27
|
+
var _a, _b, _c, _d, _e;
|
|
28
28
|
const logger = create_app_logger();
|
|
29
29
|
try {
|
|
30
30
|
// Use hazo_get_auth to get user with permissions
|
|
@@ -99,6 +99,10 @@ export async function GET(request) {
|
|
|
99
99
|
legal_acceptance: (_a = auth_result.user.legal_acceptance) !== null && _a !== void 0 ? _a : null,
|
|
100
100
|
// User's explicit locale preference (BCP 47 tag), or null if unset
|
|
101
101
|
preferred_locale: (_b = auth_result.user.preferred_locale) !== null && _b !== void 0 ? _b : null,
|
|
102
|
+
// Indexed location fields (null unless enabled + set — see location_fields_config.server.ts)
|
|
103
|
+
country: (_c = auth_result.user.country) !== null && _c !== void 0 ? _c : null,
|
|
104
|
+
state_province: (_d = auth_result.user.state_province) !== null && _d !== void 0 ? _d : null,
|
|
105
|
+
suburb: (_e = auth_result.user.suburb) !== null && _e !== void 0 ? _e : null,
|
|
102
106
|
// Permissions and user object (always included)
|
|
103
107
|
user: auth_result.user,
|
|
104
108
|
permissions: auth_result.permissions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nextauth.d.ts","sourceRoot":"","sources":["../../../src/server/routes/nextauth.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"nextauth.d.ts","sourceRoot":"","sources":["../../../src/server/routes/nextauth.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK1C,KAAK,eAAe,GAAG;IACrB,MAAM,EAAE,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;CACzC,CAAC;AAyDF,wBAAsB,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,eAAe,gBAEvE;AAED,wBAAsB,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,eAAe,gBAExE"}
|
|
@@ -4,50 +4,7 @@
|
|
|
4
4
|
import NextAuthImport from "next-auth";
|
|
5
5
|
const NextAuth = NextAuthImport.default || NextAuthImport;
|
|
6
6
|
import { get_nextauth_config } from "../../lib/auth/nextauth_config.js";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Detects the public-facing origin from request headers.
|
|
10
|
-
* Cloudflare tunnel sends: x-forwarded-host, x-forwarded-proto, cf-visitor, host
|
|
11
|
-
*/
|
|
12
|
-
function detect_proxy_origin(request) {
|
|
13
|
-
try {
|
|
14
|
-
const request_url = new URL(request.url);
|
|
15
|
-
const forwarded_host = request.headers.get("x-forwarded-host");
|
|
16
|
-
const host_header = request.headers.get("host");
|
|
17
|
-
const forwarded_proto = request.headers.get("x-forwarded-proto") || "https";
|
|
18
|
-
// Debug logging in development
|
|
19
|
-
if (process.env.NODE_ENV === "development") {
|
|
20
|
-
console.log("[NextAuth Proxy] request.url:", request.url);
|
|
21
|
-
console.log("[NextAuth Proxy] request_url.hostname:", request_url.hostname, "request_url.host:", request_url.host);
|
|
22
|
-
console.log("[NextAuth Proxy] x-forwarded-host:", forwarded_host);
|
|
23
|
-
console.log("[NextAuth Proxy] host header:", host_header);
|
|
24
|
-
console.log("[NextAuth Proxy] x-forwarded-proto:", forwarded_proto);
|
|
25
|
-
}
|
|
26
|
-
// Check x-forwarded-host first (set by Cloudflare tunnel, nginx, etc.)
|
|
27
|
-
if (forwarded_host && forwarded_host !== request_url.hostname) {
|
|
28
|
-
const origin = `${forwarded_proto}://${forwarded_host}`;
|
|
29
|
-
if (process.env.NODE_ENV === "development") {
|
|
30
|
-
console.log("[NextAuth Proxy] Detected proxy via x-forwarded-host:", origin);
|
|
31
|
-
}
|
|
32
|
-
return origin;
|
|
33
|
-
}
|
|
34
|
-
// Check host header (Cloudflare tunnel also sets this to the tunnel domain)
|
|
35
|
-
if (host_header && host_header !== request_url.host) {
|
|
36
|
-
const origin = `${forwarded_proto}://${host_header}`;
|
|
37
|
-
if (process.env.NODE_ENV === "development") {
|
|
38
|
-
console.log("[NextAuth Proxy] Detected proxy via host header:", origin);
|
|
39
|
-
}
|
|
40
|
-
return origin;
|
|
41
|
-
}
|
|
42
|
-
if (process.env.NODE_ENV === "development") {
|
|
43
|
-
console.log("[NextAuth Proxy] No proxy detected");
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
catch (e) {
|
|
47
|
-
console.error("[NextAuth Proxy] Error:", e);
|
|
48
|
-
}
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
7
|
+
import { detect_proxy_origin } from "./detect_proxy_origin.js";
|
|
51
8
|
// section: handler
|
|
52
9
|
/**
|
|
53
10
|
* Handles NextAuth requests with proxy/tunnel support.
|
|
@@ -9,14 +9,58 @@ import { sanitize_error_for_user } from "../../lib/utils/error_sanitizer.js";
|
|
|
9
9
|
import { get_legal_docs_config } from "../../lib/legal/legal_docs_config.server.js";
|
|
10
10
|
import { read_legal_doc } from "../../lib/legal/legal_docs_reader.server.js";
|
|
11
11
|
import { get_client_ip } from "../../lib/auth/hazo_get_auth.server.js";
|
|
12
|
+
import { get_location_fields_config } from "../../lib/location_fields_config.server.js";
|
|
13
|
+
import { get_app_user_data_schema } from "../../lib/app_user_data_config.server.js";
|
|
14
|
+
// section: helpers
|
|
15
|
+
/**
|
|
16
|
+
* Keeps only the location fields the app has actually enabled via
|
|
17
|
+
* `[hazo_auth__custom_fields]` — never trust the client-side field visibility
|
|
18
|
+
* alone (same rationale as every other server-side re-validation in this file).
|
|
19
|
+
*/
|
|
20
|
+
function pick_enabled_location_fields(raw) {
|
|
21
|
+
if (!raw || typeof raw !== "object")
|
|
22
|
+
return undefined;
|
|
23
|
+
const enabled = get_location_fields_config();
|
|
24
|
+
const result = {};
|
|
25
|
+
const source = raw;
|
|
26
|
+
if (enabled.country && typeof source.country === "string")
|
|
27
|
+
result.country = source.country;
|
|
28
|
+
if (enabled.state_province && typeof source.state_province === "string")
|
|
29
|
+
result.state_province = source.state_province;
|
|
30
|
+
if (enabled.suburb && typeof source.suburb === "string")
|
|
31
|
+
result.suburb = source.suburb;
|
|
32
|
+
return Object.keys(result).length > 0 ? result : undefined;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Keeps only the custom field keys present in the configured app_user_data
|
|
36
|
+
* JSON Schema — a consumer can't stuff arbitrary keys into app_user_data at
|
|
37
|
+
* signup just because the request body included them.
|
|
38
|
+
*/
|
|
39
|
+
function pick_schema_custom_fields(raw) {
|
|
40
|
+
if (!raw || typeof raw !== "object")
|
|
41
|
+
return undefined;
|
|
42
|
+
const schema = get_app_user_data_schema();
|
|
43
|
+
if (!schema)
|
|
44
|
+
return undefined;
|
|
45
|
+
const allowed_keys = Object.keys(schema.properties);
|
|
46
|
+
const source = raw;
|
|
47
|
+
const result = {};
|
|
48
|
+
for (const key of allowed_keys) {
|
|
49
|
+
if (key in source)
|
|
50
|
+
result[key] = source[key];
|
|
51
|
+
}
|
|
52
|
+
return Object.keys(result).length > 0 ? result : undefined;
|
|
53
|
+
}
|
|
12
54
|
// section: api_handler
|
|
13
55
|
export async function POST(request) {
|
|
14
56
|
var _a;
|
|
15
57
|
const logger = create_app_logger();
|
|
16
58
|
try {
|
|
17
59
|
const body = await request.json();
|
|
18
|
-
const { name, email, password, url_on_logon } = body;
|
|
60
|
+
const { name, email, password, url_on_logon, user_type } = body;
|
|
19
61
|
const legal_accepted = body === null || body === void 0 ? void 0 : body.legal_accepted;
|
|
62
|
+
const location = pick_enabled_location_fields(body === null || body === void 0 ? void 0 : body.location);
|
|
63
|
+
const custom_fields = pick_schema_custom_fields(body === null || body === void 0 ? void 0 : body.custom_fields);
|
|
20
64
|
// Validate input
|
|
21
65
|
if (!email || !password) {
|
|
22
66
|
logger.warn("registration_validation_failed", {
|
|
@@ -66,9 +110,16 @@ export async function POST(request) {
|
|
|
66
110
|
legal_accepted,
|
|
67
111
|
ip: get_client_ip(request),
|
|
68
112
|
user_agent: request.headers.get('user-agent'),
|
|
113
|
+
location,
|
|
114
|
+
custom_fields,
|
|
115
|
+
// Only forwarded as a string, never trusted further — register_user()
|
|
116
|
+
// validates it against the configured [hazo_auth__user_types] list.
|
|
117
|
+
user_type: typeof user_type === "string" ? user_type : undefined,
|
|
69
118
|
});
|
|
70
119
|
if (!result.success) {
|
|
71
|
-
const status_code = result.error === "Email address already registered" ? 409 :
|
|
120
|
+
const status_code = result.error === "Email address already registered" ? 409 :
|
|
121
|
+
result.error === "Invalid user type" ? 400 :
|
|
122
|
+
500;
|
|
72
123
|
logger.warn("registration_failed", {
|
|
73
124
|
filename: get_filename(),
|
|
74
125
|
line_number: get_line_number(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update_user.d.ts","sourceRoot":"","sources":["../../../src/server/routes/update_user.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"update_user.d.ts","sourceRoot":"","sources":["../../../src/server/routes/update_user.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AA4CxD,wBAAsB,KAAK,CAAC,OAAO,EAAE,WAAW;;;;;;IA4I/C"}
|
|
@@ -7,6 +7,26 @@ import { update_user_profile } from "../../lib/services/user_update_service.js";
|
|
|
7
7
|
import { get_filename, get_line_number } from "../../lib/utils/api_route_helpers.js";
|
|
8
8
|
import { require_auth } from "../../lib/auth/auth_utils.server.js";
|
|
9
9
|
import { get_cookie_name, get_cookie_options, BASE_COOKIE_NAMES } from "../../lib/cookies_config.server.js";
|
|
10
|
+
import { get_location_fields_config } from "../../lib/location_fields_config.server.js";
|
|
11
|
+
// section: helpers
|
|
12
|
+
/**
|
|
13
|
+
* Keeps only the location fields the app has enabled via
|
|
14
|
+
* `[hazo_auth__custom_fields]` — same re-validation as the register route.
|
|
15
|
+
*/
|
|
16
|
+
function pick_enabled_location_fields(raw) {
|
|
17
|
+
if (!raw || typeof raw !== "object")
|
|
18
|
+
return undefined;
|
|
19
|
+
const enabled = get_location_fields_config();
|
|
20
|
+
const result = {};
|
|
21
|
+
const source = raw;
|
|
22
|
+
if (enabled.country && typeof source.country === "string")
|
|
23
|
+
result.country = source.country;
|
|
24
|
+
if (enabled.state_province && typeof source.state_province === "string")
|
|
25
|
+
result.state_province = source.state_province;
|
|
26
|
+
if (enabled.suburb && typeof source.suburb === "string")
|
|
27
|
+
result.suburb = source.suburb;
|
|
28
|
+
return Object.keys(result).length > 0 ? result : undefined;
|
|
29
|
+
}
|
|
10
30
|
// section: constants
|
|
11
31
|
// BCP 47 language tag, optionally followed by a region/script subtag
|
|
12
32
|
// (e.g. "en", "en-US", "pt-BR", "zh-Hans"). Deliberately NOT an allowlist — any
|
|
@@ -46,11 +66,13 @@ export async function PATCH(request) {
|
|
|
46
66
|
}
|
|
47
67
|
const body = await request.json();
|
|
48
68
|
const { name, email, profile_picture_url, profile_source, preferred_locale } = body;
|
|
69
|
+
const location = pick_enabled_location_fields(body === null || body === void 0 ? void 0 : body.location);
|
|
49
70
|
// Validate input (at least one field must be provided)
|
|
50
71
|
if (name === undefined &&
|
|
51
72
|
email === undefined &&
|
|
52
73
|
profile_picture_url === undefined &&
|
|
53
|
-
preferred_locale === undefined
|
|
74
|
+
preferred_locale === undefined &&
|
|
75
|
+
location === undefined) {
|
|
54
76
|
logger.warn("user_update_validation_failed", {
|
|
55
77
|
filename: get_filename(),
|
|
56
78
|
line_number: get_line_number(),
|
|
@@ -77,6 +99,7 @@ export async function PATCH(request) {
|
|
|
77
99
|
profile_picture_url,
|
|
78
100
|
profile_source,
|
|
79
101
|
preferred_locale,
|
|
102
|
+
location,
|
|
80
103
|
});
|
|
81
104
|
if (!result.success) {
|
|
82
105
|
logger.warn("user_update_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" | "none" | "outdated";
|
|
30
30
|
}[];
|
|
31
31
|
}>>;
|
|
32
32
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forgot_password.d.ts","sourceRoot":"","sources":["../../src/server_pages/forgot_password.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AASrB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,MAAM,uBAAuB,GAAG;IACpC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC;IAErC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAEhC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EACzC,SAAS,EACT,SAAS,EACT,sBAAsB,EACtB,YAAgD,EAChD,aAAa,GACd,GAAE,uBAA4B,+
|
|
1
|
+
{"version":3,"file":"forgot_password.d.ts","sourceRoot":"","sources":["../../src/server_pages/forgot_password.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AASrB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,MAAM,uBAAuB,GAAG;IACpC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC;IAErC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAEhC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EACzC,SAAS,EACT,SAAS,EACT,sBAAsB,EACtB,YAAgD,EAChD,aAAa,GACd,GAAE,uBAA4B,+BAoC9B;AAGD,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -43,7 +43,7 @@ export default function ForgotPasswordPage({ image_src, image_alt, image_backgro
|
|
|
43
43
|
const finalImageAlt = image_alt || config.imageAlt;
|
|
44
44
|
const finalImageBackgroundColor = image_background_color || config.imageBackgroundColor;
|
|
45
45
|
// Pass serializable config to client wrapper, wrapped in AuthPageShell for navbar support
|
|
46
|
-
return (_jsx(AuthPageShell, { children: _jsx(ForgotPasswordClientWrapper, { image_src: finalImageSrc, image_alt: finalImageAlt, image_background_color: finalImageBackgroundColor, sign_in_path: sign_in_path, sign_in_label: sign_in_label, alreadyLoggedInMessage: config.alreadyLoggedInMessage, showLogoutButton: config.showLogoutButton, showReturnHomeButton: config.showReturnHomeButton, returnHomeButtonLabel: config.returnHomeButtonLabel, returnHomePath: config.returnHomePath, labels: {
|
|
46
|
+
return (_jsx(AuthPageShell, { children: _jsx(ForgotPasswordClientWrapper, { image_src: finalImageSrc, image_alt: finalImageAlt, image_background_color: finalImageBackgroundColor, sign_in_path: sign_in_path, sign_in_label: sign_in_label, alreadyLoggedInMessage: config.alreadyLoggedInMessage, showLogoutButton: config.showLogoutButton, showReturnHomeButton: config.showReturnHomeButton, returnHomeButtonLabel: config.returnHomeButtonLabel, returnHomePath: config.returnHomePath, alreadyLoggedInRedirectPath: config.alreadyLoggedInRedirectPath, labels: {
|
|
47
47
|
heading: fp_strings_overrides === null || fp_strings_overrides === void 0 ? void 0 : fp_strings_overrides.title,
|
|
48
48
|
subHeading: fp_strings_overrides === null || fp_strings_overrides === void 0 ? void 0 : fp_strings_overrides.subtitle,
|
|
49
49
|
submitButton: fp_strings_overrides === null || fp_strings_overrides === void 0 ? void 0 : fp_strings_overrides.ctaText,
|
|
@@ -14,5 +14,5 @@ export type ForgotPasswordClientWrapperProps = Omit<ForgotPasswordConfig, 'image
|
|
|
14
14
|
* Client wrapper for ForgotPasswordLayout
|
|
15
15
|
* Initializes hazo_connect data client on client side and passes config from server
|
|
16
16
|
*/
|
|
17
|
-
export declare function ForgotPasswordClientWrapper({ image_src, image_alt, image_background_color, sign_in_path, sign_in_label, alreadyLoggedInMessage, showLogoutButton, showReturnHomeButton, returnHomeButtonLabel, returnHomePath, labels, }: ForgotPasswordClientWrapperProps): import("react").JSX.Element;
|
|
17
|
+
export declare function ForgotPasswordClientWrapper({ image_src, image_alt, image_background_color, sign_in_path, sign_in_label, alreadyLoggedInMessage, showLogoutButton, showReturnHomeButton, returnHomeButtonLabel, returnHomePath, alreadyLoggedInRedirectPath, labels, }: ForgotPasswordClientWrapperProps): import("react").JSX.Element;
|
|
18
18
|
//# sourceMappingURL=forgot_password_client_wrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forgot_password_client_wrapper.d.ts","sourceRoot":"","sources":["../../src/server_pages/forgot_password_client_wrapper.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0DAA0D,CAAC;AAIrG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,MAAM,gCAAgC,GAAG,IAAI,CAAC,oBAAoB,EAAE,UAAU,GAAG,UAAU,GAAG,sBAAsB,CAAC,GAAG;IAC5H,SAAS,EAAE,MAAM,GAAG,eAAe,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,iHAAiH;IACjH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,oBAAoB,CAAC;CAC/B,CAAC;AAGF;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,EAC1C,SAAS,EACT,SAAS,EACT,sBAAsB,EACtB,YAAY,EACZ,aAAa,EACb,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,EACd,MAAM,GACP,EAAE,gCAAgC,+
|
|
1
|
+
{"version":3,"file":"forgot_password_client_wrapper.d.ts","sourceRoot":"","sources":["../../src/server_pages/forgot_password_client_wrapper.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0DAA0D,CAAC;AAIrG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,MAAM,gCAAgC,GAAG,IAAI,CAAC,oBAAoB,EAAE,UAAU,GAAG,UAAU,GAAG,sBAAsB,CAAC,GAAG;IAC5H,SAAS,EAAE,MAAM,GAAG,eAAe,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,iHAAiH;IACjH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,oBAAoB,CAAC;CAC/B,CAAC;AAGF;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,EAC1C,SAAS,EACT,SAAS,EACT,sBAAsB,EACtB,YAAY,EACZ,aAAa,EACb,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,EACd,2BAA2B,EAC3B,MAAM,GACP,EAAE,gCAAgC,+BAsClC"}
|
|
@@ -12,7 +12,7 @@ import { useAuthT } from "../contexts/hazo_auth_provider.js";
|
|
|
12
12
|
* Client wrapper for ForgotPasswordLayout
|
|
13
13
|
* Initializes hazo_connect data client on client side and passes config from server
|
|
14
14
|
*/
|
|
15
|
-
export function ForgotPasswordClientWrapper({ image_src, image_alt, image_background_color, sign_in_path, sign_in_label, alreadyLoggedInMessage, showLogoutButton, showReturnHomeButton, returnHomeButtonLabel, returnHomePath, labels, }) {
|
|
15
|
+
export function ForgotPasswordClientWrapper({ image_src, image_alt, image_background_color, sign_in_path, sign_in_label, alreadyLoggedInMessage, showLogoutButton, showReturnHomeButton, returnHomeButtonLabel, returnHomePath, alreadyLoggedInRedirectPath, labels, }) {
|
|
16
16
|
const t = useAuthT();
|
|
17
17
|
const [dataClient, setDataClient] = useState(null);
|
|
18
18
|
useEffect(() => {
|
|
@@ -25,5 +25,5 @@ export function ForgotPasswordClientWrapper({ image_src, image_alt, image_backgr
|
|
|
25
25
|
if (!dataClient) {
|
|
26
26
|
return (_jsx("div", { className: "cls_forgot_password_page_loading flex items-center justify-center min-h-screen", children: _jsx("div", { className: "text-slate-600 animate-pulse", children: t("shared.guard.loading") }) }));
|
|
27
27
|
}
|
|
28
|
-
return (_jsx(ForgotPasswordLayout, { image_src: image_src, image_alt: image_alt, image_background_color: image_background_color, data_client: dataClient, sign_in_path: sign_in_path, sign_in_label: sign_in_label, alreadyLoggedInMessage: alreadyLoggedInMessage, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: returnHomeButtonLabel, returnHomePath: returnHomePath, labels: labels }));
|
|
28
|
+
return (_jsx(ForgotPasswordLayout, { image_src: image_src, image_alt: image_alt, image_background_color: image_background_color, data_client: dataClient, sign_in_path: sign_in_path, sign_in_label: sign_in_label, alreadyLoggedInMessage: alreadyLoggedInMessage, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: returnHomeButtonLabel, returnHomePath: returnHomePath, alreadyLoggedInRedirectPath: alreadyLoggedInRedirectPath, labels: labels }));
|
|
29
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"my_settings.d.ts","sourceRoot":"","sources":["../../src/server_pages/my_settings.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAQrB,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,SAAS,GACV,GAAE,mBAAwB,+
|
|
1
|
+
{"version":3,"file":"my_settings.d.ts","sourceRoot":"","sources":["../../src/server_pages/my_settings.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAQrB,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,SAAS,GACV,GAAE,mBAAwB,+BAkC1B;AAGD,OAAO,EAAE,cAAc,EAAE,CAAC"}
|