hazo_auth 5.3.0 → 6.0.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/README.md +110 -17
- package/SETUP_CHECKLIST.md +7 -7
- package/cli-src/cli/generate.ts +10 -1
- package/cli-src/lib/auth/auth_types.ts +21 -12
- package/cli-src/lib/auth/hazo_get_auth.server.ts +1 -1
- package/cli-src/lib/auth/hazo_get_tenant_auth.server.ts +25 -24
- package/cli-src/lib/auth/index.ts +3 -3
- package/cli-src/lib/auth/with_auth.server.ts +15 -15
- package/dist/cli/generate.d.ts.map +1 -1
- package/dist/cli/generate.js +10 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/auth/auth_types.d.ts +13 -12
- package/dist/lib/auth/auth_types.d.ts.map +1 -1
- package/dist/lib/auth/auth_types.js +8 -0
- package/dist/lib/auth/hazo_get_auth.server.d.ts +6 -0
- package/dist/lib/auth/hazo_get_auth.server.d.ts.map +1 -1
- package/dist/lib/auth/hazo_get_auth.server.js +1 -1
- package/dist/lib/auth/hazo_get_tenant_auth.server.d.ts +8 -7
- package/dist/lib/auth/hazo_get_tenant_auth.server.d.ts.map +1 -1
- package/dist/lib/auth/hazo_get_tenant_auth.server.js +23 -22
- package/dist/lib/auth/index.d.ts +3 -3
- package/dist/lib/auth/index.d.ts.map +1 -1
- package/dist/lib/auth/index.js +1 -1
- package/dist/lib/auth/with_auth.server.d.ts +13 -13
- package/dist/lib/auth/with_auth.server.d.ts.map +1 -1
- package/dist/lib/auth/with_auth.server.js +2 -2
- package/dist/server_pages/forgot_password.d.ts +1 -1
- package/dist/server_pages/forgot_password.d.ts.map +1 -1
- package/dist/server_pages/forgot_password.js +2 -1
- package/dist/server_pages/login.d.ts +1 -1
- package/dist/server_pages/login.d.ts.map +1 -1
- package/dist/server_pages/login.js +2 -1
- package/dist/server_pages/my_settings.d.ts +1 -1
- package/dist/server_pages/my_settings.d.ts.map +1 -1
- package/dist/server_pages/my_settings.js +2 -1
- package/dist/server_pages/register.d.ts +1 -1
- package/dist/server_pages/register.d.ts.map +1 -1
- package/dist/server_pages/register.js +2 -1
- package/dist/server_pages/reset_password.d.ts +1 -1
- package/dist/server_pages/reset_password.d.ts.map +1 -1
- package/dist/server_pages/reset_password.js +2 -1
- package/dist/server_pages/verify_email.d.ts +1 -1
- package/dist/server_pages/verify_email.d.ts.map +1 -1
- package/dist/server_pages/verify_email.js +2 -1
- package/package.json +3 -3
|
@@ -103,10 +103,11 @@ export type ScopeDetails = {
|
|
|
103
103
|
tagline: string | null;
|
|
104
104
|
};
|
|
105
105
|
/**
|
|
106
|
-
*
|
|
107
|
-
* Simplified view of scope
|
|
106
|
+
* Currently selected scope information returned in tenant auth results.
|
|
107
|
+
* Simplified view of the scope chosen via the scope-selection cookie or
|
|
108
|
+
* `X-Hazo-Scope-Id` header.
|
|
108
109
|
*/
|
|
109
|
-
export type
|
|
110
|
+
export type SelectedScope = {
|
|
110
111
|
id: string;
|
|
111
112
|
name: string;
|
|
112
113
|
slug: string | null;
|
|
@@ -144,9 +145,9 @@ export type TenantAuthResult = {
|
|
|
144
145
|
permissions: string[];
|
|
145
146
|
permission_ok: boolean;
|
|
146
147
|
missing_permissions?: string[];
|
|
147
|
-
|
|
148
|
-
/** Shorthand for
|
|
149
|
-
|
|
148
|
+
selected_scope: SelectedScope | null;
|
|
149
|
+
/** Shorthand for selected_scope?.id - commonly used for DB query filters. */
|
|
150
|
+
selected_scope_id: string | null;
|
|
150
151
|
user_scopes: ScopeDetails[];
|
|
151
152
|
scope_ok?: boolean;
|
|
152
153
|
scope_access_via?: ScopeAccessInfo;
|
|
@@ -155,19 +156,19 @@ export type TenantAuthResult = {
|
|
|
155
156
|
user: null;
|
|
156
157
|
permissions: [];
|
|
157
158
|
permission_ok: false;
|
|
158
|
-
|
|
159
|
-
/** Shorthand for
|
|
160
|
-
|
|
159
|
+
selected_scope: null;
|
|
160
|
+
/** Shorthand for selected_scope?.id - commonly used for DB query filters. */
|
|
161
|
+
selected_scope_id: null;
|
|
161
162
|
user_scopes: [];
|
|
162
163
|
scope_ok?: false;
|
|
163
164
|
};
|
|
164
165
|
/**
|
|
165
|
-
* Guaranteed authenticated result with non-null
|
|
166
|
-
* Returned by require_tenant_auth when validation passes
|
|
166
|
+
* Guaranteed authenticated result with non-null selected_scope.
|
|
167
|
+
* Returned by require_tenant_auth when validation passes.
|
|
167
168
|
*/
|
|
168
169
|
export type RequiredTenantAuthResult = TenantAuthResult & {
|
|
169
170
|
authenticated: true;
|
|
170
|
-
|
|
171
|
+
selected_scope: SelectedScope;
|
|
171
172
|
};
|
|
172
173
|
/**
|
|
173
174
|
* Base error class for all hazo_auth errors
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth_types.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/auth_types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth_types.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/auth_types.ts"],"names":[],"mappings":"AAWA;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEnC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CAC/C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,cAAc,GACtB;IACE,aAAa,EAAE,IAAI,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YAAY,EAAO;CAKnD;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,aAAa;aAEtC,QAAQ,EAAE,MAAM;aAChB,WAAW,EAAE,YAAY,EAAE;gBAD3B,QAAQ,EAAE,MAAM,EAChB,WAAW,GAAE,YAAY,EAAO;CAKnD"}
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
// file_description: Type definitions and error classes for hazo_get_auth utility
|
|
2
|
+
//
|
|
3
|
+
// Naming note (v6.0.0): the field previously called `organization` (and
|
|
4
|
+
// `organization_id`) on `TenantAuthResult` was renamed to `selected_scope`
|
|
5
|
+
// (and `selected_scope_id`), and the type `TenantOrganization` was renamed
|
|
6
|
+
// to `SelectedScope`. The multi-tenancy model is scopes throughout; the
|
|
7
|
+
// old name was a legacy synonym for "the currently selected scope" derived
|
|
8
|
+
// from the scope-selection cookie/header. No deprecation shim is provided.
|
|
9
|
+
//
|
|
2
10
|
// section: types
|
|
3
11
|
/**
|
|
4
12
|
* Custom error class for permission denials
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import "server-only";
|
|
2
2
|
import { NextRequest } from "next/server";
|
|
3
3
|
import type { HazoAuthResult, HazoAuthOptions } from "./auth_types";
|
|
4
|
+
/**
|
|
5
|
+
* Gets client IP address from request
|
|
6
|
+
* @param request - NextRequest object
|
|
7
|
+
* @returns IP address string
|
|
8
|
+
*/
|
|
9
|
+
export declare function get_client_ip(request: NextRequest): string;
|
|
4
10
|
/**
|
|
5
11
|
* Main hazo_get_auth function for server-side use in API routes
|
|
6
12
|
* Returns user details, permissions, and checks required permissions
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hazo_get_auth.server.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/hazo_get_auth.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAGrB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK1C,OAAO,KAAK,EACV,cAAc,EAEd,eAAe,EAGhB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"hazo_get_auth.server.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/hazo_get_auth.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAGrB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK1C,OAAO,KAAK,EACV,cAAc,EAEd,eAAe,EAGhB,MAAM,cAAc,CAAC;AA6CtB;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAU1D;AA4SD;;;;;;;;;GASG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,WAAW,EACpB,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,cAAc,CAAC,CAmNzB"}
|
|
@@ -44,7 +44,7 @@ function parse_app_user_data(json_string) {
|
|
|
44
44
|
* @param request - NextRequest object
|
|
45
45
|
* @returns IP address string
|
|
46
46
|
*/
|
|
47
|
-
function get_client_ip(request) {
|
|
47
|
+
export function get_client_ip(request) {
|
|
48
48
|
const forwarded = request.headers.get("x-forwarded-for");
|
|
49
49
|
if (forwarded) {
|
|
50
50
|
return forwarded.split(",")[0].trim();
|
|
@@ -13,20 +13,21 @@ export declare function extract_scope_id_from_request(request: NextRequest, opti
|
|
|
13
13
|
* Tenant-aware authentication function
|
|
14
14
|
*
|
|
15
15
|
* Extracts tenant/scope context from request headers or cookies,
|
|
16
|
-
* validates access, and returns enriched result
|
|
16
|
+
* validates access, and returns enriched result including the currently
|
|
17
|
+
* selected scope.
|
|
17
18
|
*
|
|
18
19
|
* Header priority: X-Hazo-Scope-Id > Cookie
|
|
19
20
|
*
|
|
20
21
|
* @param request - NextRequest object
|
|
21
22
|
* @param options - TenantAuthOptions for customization
|
|
22
|
-
* @returns TenantAuthResult with user, permissions,
|
|
23
|
+
* @returns TenantAuthResult with user, permissions, selected_scope, and user_scopes
|
|
23
24
|
*
|
|
24
25
|
* @example
|
|
25
26
|
* ```typescript
|
|
26
27
|
* const auth = await hazo_get_tenant_auth(request);
|
|
27
|
-
* if (auth.authenticated && auth.
|
|
28
|
+
* if (auth.authenticated && auth.selected_scope) {
|
|
28
29
|
* // Access tenant-specific data
|
|
29
|
-
* const data = await getData(auth.
|
|
30
|
+
* const data = await getData(auth.selected_scope.id);
|
|
30
31
|
* }
|
|
31
32
|
* ```
|
|
32
33
|
*/
|
|
@@ -41,15 +42,15 @@ export declare function hazo_get_tenant_auth(request: NextRequest, options?: Ten
|
|
|
41
42
|
*
|
|
42
43
|
* @param request - NextRequest object
|
|
43
44
|
* @param options - TenantAuthOptions for customization
|
|
44
|
-
* @returns RequiredTenantAuthResult with guaranteed non-null
|
|
45
|
+
* @returns RequiredTenantAuthResult with guaranteed non-null selected_scope
|
|
45
46
|
* @throws AuthenticationRequiredError, TenantRequiredError, TenantAccessDeniedError
|
|
46
47
|
*
|
|
47
48
|
* @example
|
|
48
49
|
* ```typescript
|
|
49
50
|
* try {
|
|
50
51
|
* const auth = await require_tenant_auth(request);
|
|
51
|
-
* // auth.
|
|
52
|
-
* const data = await getData(auth.
|
|
52
|
+
* // auth.selected_scope is guaranteed non-null here
|
|
53
|
+
* const data = await getData(auth.selected_scope.id);
|
|
53
54
|
* } catch (error) {
|
|
54
55
|
* if (error instanceof HazoAuthError) {
|
|
55
56
|
* return NextResponse.json(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hazo_get_tenant_auth.server.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/hazo_get_tenant_auth.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAGrB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAO1C,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,EAGzB,MAAM,cAAc,CAAC;AAqBtB;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,iBAAiB,GACzB,MAAM,GAAG,SAAS,CAYpB;AAiCD
|
|
1
|
+
{"version":3,"file":"hazo_get_tenant_auth.server.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/hazo_get_tenant_auth.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAGrB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAO1C,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,EAGzB,MAAM,cAAc,CAAC;AAqBtB;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,iBAAiB,GACzB,MAAM,GAAG,SAAS,CAYpB;AAiCD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,WAAW,EACpB,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,gBAAgB,CAAC,CA0F3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,WAAW,EACpB,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,wBAAwB,CAAC,CA0BnC"}
|
|
@@ -39,12 +39,12 @@ export function extract_scope_id_from_request(request, options) {
|
|
|
39
39
|
return cookie_value;
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
|
-
* Builds
|
|
42
|
+
* Builds SelectedScope from scope details and access info.
|
|
43
43
|
* @param scope_details - Full scope details from cache
|
|
44
44
|
* @param is_super_admin - Whether user is accessing as super admin
|
|
45
|
-
* @returns
|
|
45
|
+
* @returns SelectedScope object
|
|
46
46
|
*/
|
|
47
|
-
function
|
|
47
|
+
function build_selected_scope(scope_details, is_super_admin) {
|
|
48
48
|
return {
|
|
49
49
|
id: scope_details.id,
|
|
50
50
|
name: scope_details.name,
|
|
@@ -67,20 +67,21 @@ function build_tenant_organization(scope_details, is_super_admin) {
|
|
|
67
67
|
* Tenant-aware authentication function
|
|
68
68
|
*
|
|
69
69
|
* Extracts tenant/scope context from request headers or cookies,
|
|
70
|
-
* validates access, and returns enriched result
|
|
70
|
+
* validates access, and returns enriched result including the currently
|
|
71
|
+
* selected scope.
|
|
71
72
|
*
|
|
72
73
|
* Header priority: X-Hazo-Scope-Id > Cookie
|
|
73
74
|
*
|
|
74
75
|
* @param request - NextRequest object
|
|
75
76
|
* @param options - TenantAuthOptions for customization
|
|
76
|
-
* @returns TenantAuthResult with user, permissions,
|
|
77
|
+
* @returns TenantAuthResult with user, permissions, selected_scope, and user_scopes
|
|
77
78
|
*
|
|
78
79
|
* @example
|
|
79
80
|
* ```typescript
|
|
80
81
|
* const auth = await hazo_get_tenant_auth(request);
|
|
81
|
-
* if (auth.authenticated && auth.
|
|
82
|
+
* if (auth.authenticated && auth.selected_scope) {
|
|
82
83
|
* // Access tenant-specific data
|
|
83
|
-
* const data = await getData(auth.
|
|
84
|
+
* const data = await getData(auth.selected_scope.id);
|
|
84
85
|
* }
|
|
85
86
|
* ```
|
|
86
87
|
*/
|
|
@@ -98,8 +99,8 @@ export async function hazo_get_tenant_auth(request, options = {}) {
|
|
|
98
99
|
user: null,
|
|
99
100
|
permissions: [],
|
|
100
101
|
permission_ok: false,
|
|
101
|
-
|
|
102
|
-
|
|
102
|
+
selected_scope: null,
|
|
103
|
+
selected_scope_id: null,
|
|
103
104
|
user_scopes: [],
|
|
104
105
|
scope_ok: false,
|
|
105
106
|
};
|
|
@@ -110,20 +111,20 @@ export async function hazo_get_tenant_auth(request, options = {}) {
|
|
|
110
111
|
const cached = cache.get(auth_result.user.id);
|
|
111
112
|
// User scopes from cache or empty array
|
|
112
113
|
const user_scopes = (cached === null || cached === void 0 ? void 0 : cached.scopes) || [];
|
|
113
|
-
// Build
|
|
114
|
-
let
|
|
114
|
+
// Build selected_scope info if scope access was successful
|
|
115
|
+
let selected_scope = null;
|
|
115
116
|
if (scope_id && auth_result.scope_ok && auth_result.scope_access_via) {
|
|
116
117
|
// Find the scope in user's scopes that matches the access_via scope
|
|
117
118
|
const access_scope = user_scopes.find((s) => { var _a; return s.id === ((_a = auth_result.scope_access_via) === null || _a === void 0 ? void 0 : _a.scope_id); });
|
|
118
119
|
if (access_scope) {
|
|
119
|
-
|
|
120
|
+
selected_scope = build_selected_scope(access_scope, auth_result.scope_access_via.is_super_admin || false);
|
|
120
121
|
}
|
|
121
122
|
else if (auth_result.scope_access_via.is_super_admin) {
|
|
122
123
|
// Super admin accessing scope they're not assigned to - fetch scope details
|
|
123
124
|
const hazoConnect = get_hazo_connect_instance();
|
|
124
125
|
const scope_result = await get_scope_by_id(hazoConnect, scope_id);
|
|
125
126
|
if (scope_result.success && scope_result.scope) {
|
|
126
|
-
|
|
127
|
+
selected_scope = {
|
|
127
128
|
id: scope_result.scope.id,
|
|
128
129
|
name: scope_result.scope.name,
|
|
129
130
|
slug: null, // Could fetch from scope if slug column exists
|
|
@@ -148,8 +149,8 @@ export async function hazo_get_tenant_auth(request, options = {}) {
|
|
|
148
149
|
permissions: auth_result.permissions,
|
|
149
150
|
permission_ok: auth_result.permission_ok,
|
|
150
151
|
missing_permissions: auth_result.missing_permissions,
|
|
151
|
-
|
|
152
|
-
|
|
152
|
+
selected_scope,
|
|
153
|
+
selected_scope_id: (selected_scope === null || selected_scope === void 0 ? void 0 : selected_scope.id) || null,
|
|
153
154
|
user_scopes,
|
|
154
155
|
scope_ok: auth_result.scope_ok,
|
|
155
156
|
scope_access_via: auth_result.scope_access_via,
|
|
@@ -165,15 +166,15 @@ export async function hazo_get_tenant_auth(request, options = {}) {
|
|
|
165
166
|
*
|
|
166
167
|
* @param request - NextRequest object
|
|
167
168
|
* @param options - TenantAuthOptions for customization
|
|
168
|
-
* @returns RequiredTenantAuthResult with guaranteed non-null
|
|
169
|
+
* @returns RequiredTenantAuthResult with guaranteed non-null selected_scope
|
|
169
170
|
* @throws AuthenticationRequiredError, TenantRequiredError, TenantAccessDeniedError
|
|
170
171
|
*
|
|
171
172
|
* @example
|
|
172
173
|
* ```typescript
|
|
173
174
|
* try {
|
|
174
175
|
* const auth = await require_tenant_auth(request);
|
|
175
|
-
* // auth.
|
|
176
|
-
* const data = await getData(auth.
|
|
176
|
+
* // auth.selected_scope is guaranteed non-null here
|
|
177
|
+
* const data = await getData(auth.selected_scope.id);
|
|
177
178
|
* } catch (error) {
|
|
178
179
|
* if (error instanceof HazoAuthError) {
|
|
179
180
|
* return NextResponse.json(
|
|
@@ -197,10 +198,10 @@ export async function require_tenant_auth(request, options = {}) {
|
|
|
197
198
|
if (scope_id && !result.scope_ok) {
|
|
198
199
|
throw new TenantAccessDeniedError(scope_id, result.user_scopes);
|
|
199
200
|
}
|
|
200
|
-
// Check if
|
|
201
|
-
if (!result.
|
|
202
|
-
throw new TenantRequiredError("No
|
|
201
|
+
// Check if scope context is required but missing
|
|
202
|
+
if (!result.selected_scope) {
|
|
203
|
+
throw new TenantRequiredError("No tenant scope context provided. Include X-Hazo-Scope-Id header or scope cookie.", result.user_scopes);
|
|
203
204
|
}
|
|
204
|
-
// Type assertion: at this point we know
|
|
205
|
+
// Type assertion: at this point we know selected_scope is non-null
|
|
205
206
|
return result;
|
|
206
207
|
}
|
package/dist/lib/auth/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export * from "./auth_types.js";
|
|
2
|
-
export { hazo_get_auth } from "./hazo_get_auth.server.js";
|
|
2
|
+
export { hazo_get_auth, get_client_ip } from "./hazo_get_auth.server.js";
|
|
3
3
|
export { get_authenticated_user, require_auth, is_authenticated, } from "./auth_utils.server.js";
|
|
4
4
|
export type { AuthResult, AuthUser } from "./auth_utils.server";
|
|
5
5
|
export { ensure_anon_id } from "./ensure_anon_id.server.js";
|
|
6
6
|
export { hazo_get_tenant_auth, require_tenant_auth, extract_scope_id_from_request, } from "./hazo_get_tenant_auth.server.js";
|
|
7
|
-
export type { ScopeDetails,
|
|
7
|
+
export type { ScopeDetails, SelectedScope, TenantAuthOptions, TenantAuthResult, RequiredTenantAuthResult, } from "./auth_types";
|
|
8
8
|
export { HazoAuthError, AuthenticationRequiredError, TenantRequiredError, TenantAccessDeniedError, } from "./auth_types.js";
|
|
9
9
|
export { get_server_auth_user } from "./server_auth.js";
|
|
10
10
|
export type { ServerAuthResult } from "./server_auth";
|
|
11
11
|
export { withAuth, withOptionalAuth, hasPermission, hasAllPermissions, hasAnyPermission, requirePermission, requireAllPermissions, } from "./with_auth.server.js";
|
|
12
|
-
export type { AuthenticatedTenantAuth,
|
|
12
|
+
export type { AuthenticatedTenantAuth, AuthenticatedTenantAuthWithSelectedScope, WithAuthOptions, } from "./with_auth.server";
|
|
13
13
|
export { get_auth_cache, reset_auth_cache } from "./auth_cache.js";
|
|
14
14
|
export { get_rate_limiter, reset_rate_limiter } from "./auth_rate_limiter.js";
|
|
15
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/index.ts"],"names":[],"mappings":"AAEA,cAAc,cAAc,CAAC;AAG7B,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/index.ts"],"names":[],"mappings":"AAEA,cAAc,cAAc,CAAC;AAG7B,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EACL,sBAAsB,EACtB,YAAY,EACZ,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAGhE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAGzD,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,6BAA6B,GAC9B,MAAM,+BAA+B,CAAC;AACvC,YAAY,EACV,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,aAAa,EACb,2BAA2B,EAC3B,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGtD,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,uBAAuB,EACvB,wCAAwC,EACxC,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGhE,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/lib/auth/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// section: type_exports
|
|
3
3
|
export * from "./auth_types.js";
|
|
4
4
|
// section: server_exports
|
|
5
|
-
export { hazo_get_auth } from "./hazo_get_auth.server.js";
|
|
5
|
+
export { hazo_get_auth, get_client_ip } from "./hazo_get_auth.server.js";
|
|
6
6
|
export { get_authenticated_user, require_auth, is_authenticated, } from "./auth_utils.server.js";
|
|
7
7
|
// section: anon_id_exports (v5.2)
|
|
8
8
|
export { ensure_anon_id } from "./ensure_anon_id.server.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "server-only";
|
|
2
2
|
import { NextRequest, NextResponse } from "next/server";
|
|
3
|
-
import { type TenantAuthOptions, type TenantAuthResult, type
|
|
3
|
+
import { type TenantAuthOptions, type TenantAuthResult, type SelectedScope, type HazoAuthUser, type ScopeDetails, type ScopeAccessInfo } from "./auth_types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Authenticated branch of TenantAuthResult - guaranteed authenticated: true
|
|
6
6
|
*/
|
|
@@ -10,18 +10,18 @@ export type AuthenticatedTenantAuth = {
|
|
|
10
10
|
permissions: string[];
|
|
11
11
|
permission_ok: boolean;
|
|
12
12
|
missing_permissions?: string[];
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
selected_scope: SelectedScope | null;
|
|
14
|
+
selected_scope_id: string | null;
|
|
15
15
|
user_scopes: ScopeDetails[];
|
|
16
16
|
scope_ok?: boolean;
|
|
17
17
|
scope_access_via?: ScopeAccessInfo;
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
|
-
* Authenticated branch with guaranteed non-null
|
|
20
|
+
* Authenticated branch with guaranteed non-null selected_scope
|
|
21
21
|
*/
|
|
22
|
-
export type
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
export type AuthenticatedTenantAuthWithSelectedScope = AuthenticatedTenantAuth & {
|
|
23
|
+
selected_scope: SelectedScope;
|
|
24
|
+
selected_scope_id: string;
|
|
25
25
|
};
|
|
26
26
|
/**
|
|
27
27
|
* Options for withAuth/withOptionalAuth wrappers
|
|
@@ -29,8 +29,8 @@ export type AuthenticatedTenantAuthWithOrg = AuthenticatedTenantAuth & {
|
|
|
29
29
|
*/
|
|
30
30
|
export type WithAuthOptions = TenantAuthOptions & {
|
|
31
31
|
/**
|
|
32
|
-
* If true, requires
|
|
33
|
-
* Narrows auth type to
|
|
32
|
+
* If true, requires tenant/scope context (403 if missing)
|
|
33
|
+
* Narrows auth type to AuthenticatedTenantAuthWithSelectedScope
|
|
34
34
|
*/
|
|
35
35
|
require_tenant?: boolean;
|
|
36
36
|
};
|
|
@@ -47,7 +47,7 @@ type AuthenticatedHandler<TParams> = (request: NextRequest, auth: AuthenticatedT
|
|
|
47
47
|
/**
|
|
48
48
|
* Handler function signature for withAuth with require_tenant
|
|
49
49
|
*/
|
|
50
|
-
type AuthenticatedTenantHandler<TParams> = (request: NextRequest, auth:
|
|
50
|
+
type AuthenticatedTenantHandler<TParams> = (request: NextRequest, auth: AuthenticatedTenantAuthWithSelectedScope, params: TParams) => Promise<NextResponse> | NextResponse;
|
|
51
51
|
/**
|
|
52
52
|
* Handler function signature for withOptionalAuth
|
|
53
53
|
*/
|
|
@@ -57,7 +57,7 @@ type OptionalAuthHandler<TParams> = (request: NextRequest, auth: TenantAuthResul
|
|
|
57
57
|
*
|
|
58
58
|
* - Calls `hazo_get_tenant_auth` and returns 401 if not authenticated
|
|
59
59
|
* - Returns 403 if `required_permissions` are specified and not satisfied
|
|
60
|
-
* - Returns 403 if `require_tenant: true` and no
|
|
60
|
+
* - Returns 403 if `require_tenant: true` and no tenant/scope context
|
|
61
61
|
* - Resolves `await context.params` (Next.js 15 pattern)
|
|
62
62
|
* - Catches HazoAuthError, PermissionError, and unexpected errors
|
|
63
63
|
*
|
|
@@ -80,8 +80,8 @@ type OptionalAuthHandler<TParams> = (request: NextRequest, auth: TenantAuthResul
|
|
|
80
80
|
* // With tenant requirement
|
|
81
81
|
* export const GET = withAuth<{ id: string }>(
|
|
82
82
|
* async (request, auth, { id }) => {
|
|
83
|
-
* // auth.
|
|
84
|
-
* const data = await getData(auth.
|
|
83
|
+
* // auth.selected_scope is guaranteed non-null
|
|
84
|
+
* const data = await getData(auth.selected_scope.id, id);
|
|
85
85
|
* return NextResponse.json(data);
|
|
86
86
|
* },
|
|
87
87
|
* { require_tenant: true }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with_auth.server.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/with_auth.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAGrB,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,EAGL,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,
|
|
1
|
+
{"version":3,"file":"with_auth.server.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/with_auth.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAGrB,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,M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EAC7B,UAAU,EAAE,MAAM,GACjB,OAAO,CAET;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,uBAAuB,EAC7B,WAAW,EAAE,MAAM,EAAE,GACpB,OAAO,CAET;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,uBAAuB,EAC7B,WAAW,EAAE,MAAM,EAAE,GACpB,OAAO,CAET;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,uBAAuB,EAC7B,UAAU,EAAE,MAAM,GACjB,IAAI,CAQN;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,uBAAuB,EAC7B,WAAW,EAAE,MAAM,EAAE,GACpB,IAAI,CASN"}
|
|
@@ -50,9 +50,9 @@ export function withAuth(handler, options = {}) {
|
|
|
50
50
|
})), { status: 403 });
|
|
51
51
|
}
|
|
52
52
|
// Check tenant requirement
|
|
53
|
-
if (options.require_tenant && !auth.
|
|
53
|
+
if (options.require_tenant && !auth.selected_scope) {
|
|
54
54
|
return NextResponse.json({
|
|
55
|
-
error: "
|
|
55
|
+
error: "Tenant scope context required",
|
|
56
56
|
code: "TENANT_REQUIRED",
|
|
57
57
|
}, { status: 403 });
|
|
58
58
|
}
|
|
@@ -50,6 +50,6 @@ export type ForgotPasswordPageProps = {
|
|
|
50
50
|
* @param props - Optional visual and navigation customization props
|
|
51
51
|
* @returns Server-rendered forgot password page
|
|
52
52
|
*/
|
|
53
|
-
export default function ForgotPasswordPage(
|
|
53
|
+
export default function ForgotPasswordPage(props: ForgotPasswordPageProps): import("react/jsx-runtime").JSX.Element;
|
|
54
54
|
export { ForgotPasswordPage };
|
|
55
55
|
//# sourceMappingURL=forgot_password.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forgot_password.d.ts","sourceRoot":"","sources":["../../src/server_pages/forgot_password.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAQrB,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;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,
|
|
1
|
+
{"version":3,"file":"forgot_password.d.ts","sourceRoot":"","sources":["../../src/server_pages/forgot_password.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAQrB,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;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,2CAiCxE;AAGD,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -31,7 +31,8 @@ import { DEFAULT_FORGOT_PASSWORD } from "../lib/config/default_config.js";
|
|
|
31
31
|
* @param props - Optional visual and navigation customization props
|
|
32
32
|
* @returns Server-rendered forgot password page
|
|
33
33
|
*/
|
|
34
|
-
export default function ForgotPasswordPage(
|
|
34
|
+
export default function ForgotPasswordPage(props) {
|
|
35
|
+
const { image_src, image_alt, image_background_color, sign_in_path = DEFAULT_FORGOT_PASSWORD.loginPath, sign_in_label = DEFAULT_FORGOT_PASSWORD.loginLabel, } = props !== null && props !== void 0 ? props : {};
|
|
35
36
|
// Load configuration from INI file (with defaults including asset images)
|
|
36
37
|
const config = get_forgot_password_config();
|
|
37
38
|
// Use props if provided, otherwise fall back to config (which includes default asset image)
|
|
@@ -52,6 +52,6 @@ export type LoginPageProps = {
|
|
|
52
52
|
* @param props - Optional visual customization props
|
|
53
53
|
* @returns Server-rendered login page
|
|
54
54
|
*/
|
|
55
|
-
export default function LoginPage(
|
|
55
|
+
export default function LoginPage(props: LoginPageProps): import("react/jsx-runtime").JSX.Element;
|
|
56
56
|
export { LoginPage };
|
|
57
57
|
//# sourceMappingURL=login.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/server_pages/login.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AASrB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,MAAM,cAAc,GAAG;IAC3B;;;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;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,YAAY,GAAG,WAAW,CAAC;CACrC,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/server_pages/login.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AASrB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,MAAM,cAAc,GAAG;IAC3B;;;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;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,YAAY,GAAG,WAAW,CAAC;CACrC,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,KAAK,EAAE,cAAc,2CAiEtD;AAGD,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -32,7 +32,8 @@ import { FloatingHomeLink } from "../components/layouts/shared/components/floati
|
|
|
32
32
|
* @param props - Optional visual customization props
|
|
33
33
|
* @returns Server-rendered login page
|
|
34
34
|
*/
|
|
35
|
-
export default function LoginPage(
|
|
35
|
+
export default function LoginPage(props) {
|
|
36
|
+
const { image_src, image_alt, image_background_color, layout = "two_column", } = props !== null && props !== void 0 ? props : {};
|
|
36
37
|
// Load configuration from INI file (with defaults including asset images)
|
|
37
38
|
const config = get_login_config();
|
|
38
39
|
// Use props if provided, otherwise fall back to config (which includes default asset image)
|
|
@@ -50,6 +50,6 @@ export type MySettingsPageProps = {
|
|
|
50
50
|
* @param props - Optional className for custom styling
|
|
51
51
|
* @returns Server-rendered my settings component
|
|
52
52
|
*/
|
|
53
|
-
export default function MySettingsPage(
|
|
53
|
+
export default function MySettingsPage(props: MySettingsPageProps): import("react/jsx-runtime").JSX.Element;
|
|
54
54
|
export { MySettingsPage };
|
|
55
55
|
//# sourceMappingURL=my_settings.d.ts.map
|
|
@@ -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,
|
|
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,KAAK,EAAE,mBAAmB,2CAiChE;AAGD,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -52,7 +52,8 @@ import { AuthPageShell } from "../components/layouts/shared/components/auth_page
|
|
|
52
52
|
* @param props - Optional className for custom styling
|
|
53
53
|
* @returns Server-rendered my settings component
|
|
54
54
|
*/
|
|
55
|
-
export default function MySettingsPage(
|
|
55
|
+
export default function MySettingsPage(props) {
|
|
56
|
+
const { className } = props !== null && props !== void 0 ? props : {};
|
|
56
57
|
// Load configuration from INI file (with defaults)
|
|
57
58
|
const config = get_my_settings_config();
|
|
58
59
|
// Render layout with all server-initialized configuration, wrapped in AuthPageShell for navbar support
|
|
@@ -48,6 +48,6 @@ export type RegisterPageProps = {
|
|
|
48
48
|
* @param props - Optional visual customization props
|
|
49
49
|
* @returns Server-rendered register page
|
|
50
50
|
*/
|
|
51
|
-
export default function RegisterPage(
|
|
51
|
+
export default function RegisterPage(props: RegisterPageProps): import("react/jsx-runtime").JSX.Element;
|
|
52
52
|
export { RegisterPage };
|
|
53
53
|
//# sourceMappingURL=register.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/server_pages/register.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AASrB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;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;;;;OAIG;IACH,MAAM,CAAC,EAAE,YAAY,GAAG,WAAW,CAAC;CACrC,CAAC;AAIF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/server_pages/register.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AASrB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;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;;;;OAIG;IACH,MAAM,CAAC,EAAE,YAAY,GAAG,WAAW,CAAC;CACrC,CAAC;AAIF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAK,EAAE,iBAAiB,2CAuD5D;AAGD,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -34,7 +34,8 @@ import { FloatingHomeLink } from "../components/layouts/shared/components/floati
|
|
|
34
34
|
* @param props - Optional visual customization props
|
|
35
35
|
* @returns Server-rendered register page
|
|
36
36
|
*/
|
|
37
|
-
export default function RegisterPage(
|
|
37
|
+
export default function RegisterPage(props) {
|
|
38
|
+
const { image_src, image_alt, image_background_color, layout = "two_column", } = props !== null && props !== void 0 ? props : {};
|
|
38
39
|
// Load configuration from INI file (with defaults including asset images)
|
|
39
40
|
const config = get_register_config();
|
|
40
41
|
// Use props if provided, otherwise fall back to config (which includes default asset image)
|
|
@@ -41,6 +41,6 @@ export type ResetPasswordPageProps = {
|
|
|
41
41
|
* @param props - Optional visual customization props
|
|
42
42
|
* @returns Server-rendered reset password page
|
|
43
43
|
*/
|
|
44
|
-
export default function ResetPasswordPage(
|
|
44
|
+
export default function ResetPasswordPage(props: ResetPasswordPageProps): import("react/jsx-runtime").JSX.Element;
|
|
45
45
|
export { ResetPasswordPage };
|
|
46
46
|
//# sourceMappingURL=reset_password.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reset_password.d.ts","sourceRoot":"","sources":["../../src/server_pages/reset_password.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAOrB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;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;CACjC,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,
|
|
1
|
+
{"version":3,"file":"reset_password.d.ts","sourceRoot":"","sources":["../../src/server_pages/reset_password.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAOrB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;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;CACjC,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,2CAkCtE;AAGD,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -31,7 +31,8 @@ import { AuthPageShell } from "../components/layouts/shared/components/auth_page
|
|
|
31
31
|
* @param props - Optional visual customization props
|
|
32
32
|
* @returns Server-rendered reset password page
|
|
33
33
|
*/
|
|
34
|
-
export default function ResetPasswordPage(
|
|
34
|
+
export default function ResetPasswordPage(props) {
|
|
35
|
+
const { image_src, image_alt, image_background_color, } = props !== null && props !== void 0 ? props : {};
|
|
35
36
|
// Load configuration from INI file (with defaults including asset images)
|
|
36
37
|
const config = get_reset_password_config();
|
|
37
38
|
// Use props if provided, otherwise fall back to config (which includes default asset image)
|
|
@@ -50,6 +50,6 @@ export type VerifyEmailPageProps = {
|
|
|
50
50
|
* @param props - Optional visual and behavior customization props
|
|
51
51
|
* @returns Server-rendered email verification page
|
|
52
52
|
*/
|
|
53
|
-
export default function VerifyEmailPage(
|
|
53
|
+
export default function VerifyEmailPage(props: VerifyEmailPageProps): import("react/jsx-runtime").JSX.Element;
|
|
54
54
|
export { VerifyEmailPage };
|
|
55
55
|
//# sourceMappingURL=verify_email.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify_email.d.ts","sourceRoot":"","sources":["../../src/server_pages/verify_email.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAQrB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;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,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,
|
|
1
|
+
{"version":3,"file":"verify_email.d.ts","sourceRoot":"","sources":["../../src/server_pages/verify_email.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAQrB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;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,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,KAAK,EAAE,oBAAoB,2CAiClE;AAGD,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -31,7 +31,8 @@ import { DEFAULT_EMAIL_VERIFICATION } from "../lib/config/default_config.js";
|
|
|
31
31
|
* @param props - Optional visual and behavior customization props
|
|
32
32
|
* @returns Server-rendered email verification page
|
|
33
33
|
*/
|
|
34
|
-
export default function VerifyEmailPage(
|
|
34
|
+
export default function VerifyEmailPage(props) {
|
|
35
|
+
const { image_src, image_alt, image_background_color, redirect_delay = DEFAULT_EMAIL_VERIFICATION.redirectDelay, login_path = DEFAULT_EMAIL_VERIFICATION.loginPath, } = props !== null && props !== void 0 ? props : {};
|
|
35
36
|
// Load configuration from INI file (with defaults including asset images)
|
|
36
37
|
const config = get_email_verification_config();
|
|
37
38
|
// Use props if provided, otherwise fall back to config (which includes default asset image)
|