hazo_auth 10.11.0 → 10.14.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 +12 -0
- package/cli-src/lib/auth/hazo_get_tenant_auth.server.ts +12 -3
- package/cli-src/lib/auth/index.ts +2 -0
- package/cli-src/lib/otp_config.server.ts +11 -0
- package/config/hazo_auth_config.example.ini +8 -0
- package/dist/lib/auth/hazo_get_tenant_auth.server.d.ts +10 -0
- package/dist/lib/auth/hazo_get_tenant_auth.server.d.ts.map +1 -1
- package/dist/lib/auth/hazo_get_tenant_auth.server.js +11 -3
- package/dist/lib/auth/index.d.ts +1 -1
- package/dist/lib/auth/index.d.ts.map +1 -1
- package/dist/lib/auth/index.js +1 -1
- package/dist/lib/otp_config.server.d.ts +6 -0
- package/dist/lib/otp_config.server.d.ts.map +1 -1
- package/dist/lib/otp_config.server.js +7 -0
- package/dist/server_pages/otp.d.ts +12 -1
- package/dist/server_pages/otp.d.ts.map +1 -1
- package/dist/server_pages/otp.js +12 -2
- package/package.json +27 -85
package/README.md
CHANGED
|
@@ -3291,6 +3291,18 @@ export default function Page(props) { return <OTPPage {...props} />; }
|
|
|
3291
3291
|
|
|
3292
3292
|
Enable in config: `[hazo_auth__otp] enable_email_otp = true`. Run `npx hazo_auth migrate migrations/015_email_otp.sql`.
|
|
3293
3293
|
|
|
3294
|
+
The visual panel image defaults to `/hazo_auth/images/login_default.jpg` (what `npx hazo_auth init` copies into `public/`). Override it per-page or in config — apps serving the packaged images from the generated `/api/hazo_auth/assets/[name]` route want the latter path:
|
|
3295
|
+
|
|
3296
|
+
```tsx
|
|
3297
|
+
<OTPPage {...props} image_src="/api/hazo_auth/assets/login_default.jpg" />
|
|
3298
|
+
```
|
|
3299
|
+
|
|
3300
|
+
```ini
|
|
3301
|
+
[hazo_auth__otp]
|
|
3302
|
+
otp_image_src = /api/hazo_auth/assets/login_default.jpg
|
|
3303
|
+
otp_image_alt = Sign in with a one-time code
|
|
3304
|
+
```
|
|
3305
|
+
|
|
3294
3306
|
## Theming
|
|
3295
3307
|
|
|
3296
3308
|
```tsx
|
|
@@ -32,9 +32,18 @@ import {
|
|
|
32
32
|
const DEFAULT_SCOPE_HEADER = "X-Hazo-Scope-Id";
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
|
-
* Base cookie name for scope ID (will have prefix applied)
|
|
35
|
+
* Base cookie name for scope ID (will have prefix applied).
|
|
36
|
+
*
|
|
37
|
+
* Exported so a consuming app can SET the same cookie this module READS —
|
|
38
|
+
* without it, an app implementing a scope switcher has to duplicate the
|
|
39
|
+
* configured prefix and drift the moment it changes.
|
|
36
40
|
*/
|
|
37
|
-
const
|
|
41
|
+
export const SCOPE_COOKIE_BASE_NAME = "hazo_auth_scope_id";
|
|
42
|
+
|
|
43
|
+
/** The live, prefixed scope cookie name for this deployment. */
|
|
44
|
+
export function get_scope_cookie_name(): string {
|
|
45
|
+
return get_cookie_name(SCOPE_COOKIE_BASE_NAME);
|
|
46
|
+
}
|
|
38
47
|
|
|
39
48
|
// section: helpers
|
|
40
49
|
|
|
@@ -57,7 +66,7 @@ export function extract_scope_id_from_request(
|
|
|
57
66
|
}
|
|
58
67
|
|
|
59
68
|
// Check cookie (with prefix)
|
|
60
|
-
const cookie_name = options.scope_cookie_name || get_cookie_name(
|
|
69
|
+
const cookie_name = options.scope_cookie_name || get_cookie_name(SCOPE_COOKIE_BASE_NAME);
|
|
61
70
|
const cookie_value = request.cookies.get(cookie_name)?.value;
|
|
62
71
|
return cookie_value;
|
|
63
72
|
}
|
|
@@ -18,6 +18,11 @@ export const OTP_CONFIG_DEFAULTS = {
|
|
|
18
18
|
max_verify_attempts: 5,
|
|
19
19
|
auto_assign_scope_id: "00000000-0000-0000-0000-000000000001",
|
|
20
20
|
auto_assign_role_name: "member",
|
|
21
|
+
// Matches OTPLayout's own default. Apps that never ran `npx hazo_auth init`
|
|
22
|
+
// (so have no public/hazo_auth/images/) should point this at the packaged
|
|
23
|
+
// asset route instead: /api/hazo_auth/assets/login_default.jpg
|
|
24
|
+
image_src: "/hazo_auth/images/login_default.jpg",
|
|
25
|
+
image_alt: "Sign in with a one-time code",
|
|
21
26
|
} as const;
|
|
22
27
|
|
|
23
28
|
// section: types
|
|
@@ -44,6 +49,10 @@ export type OtpConfig = {
|
|
|
44
49
|
auto_assign_scope_id: string;
|
|
45
50
|
/** Role name to assign within the auto-assign scope */
|
|
46
51
|
auto_assign_role_name: string;
|
|
52
|
+
/** Image shown in the OTP page's visual panel */
|
|
53
|
+
image_src: string;
|
|
54
|
+
/** Alt text for the OTP page's visual panel image */
|
|
55
|
+
image_alt: string;
|
|
47
56
|
};
|
|
48
57
|
|
|
49
58
|
// section: helpers
|
|
@@ -79,6 +88,8 @@ export function get_otp_config(): OtpConfig {
|
|
|
79
88
|
max_verify_attempts: get_config_number(section, "otp_max_verify_attempts", d.max_verify_attempts),
|
|
80
89
|
auto_assign_scope_id: get_config_value(section, "otp_auto_assign_scope_id", d.auto_assign_scope_id),
|
|
81
90
|
auto_assign_role_name: get_config_value(section, "otp_auto_assign_role_name", d.auto_assign_role_name),
|
|
91
|
+
image_src: get_config_value(section, "otp_image_src", d.image_src),
|
|
92
|
+
image_alt: get_config_value(section, "otp_image_alt", d.image_alt),
|
|
82
93
|
};
|
|
83
94
|
}
|
|
84
95
|
|
|
@@ -123,6 +123,14 @@ enable_admin_ui = true
|
|
|
123
123
|
# require_number = false
|
|
124
124
|
# require_special = false
|
|
125
125
|
|
|
126
|
+
[hazo_auth__otp]
|
|
127
|
+
# Visual panel image on the email-OTP sign-in page.
|
|
128
|
+
# Default: /hazo_auth/images/login_default.jpg — i.e. the copy `npx hazo_auth init`
|
|
129
|
+
# places in your public/ directory. Apps that skipped that copy should point this
|
|
130
|
+
# at the packaged asset route instead:
|
|
131
|
+
# otp_image_src = /api/hazo_auth/assets/login_default.jpg
|
|
132
|
+
# otp_image_alt = Sign in with a one-time code
|
|
133
|
+
|
|
126
134
|
[hazo_auth__login_layout]
|
|
127
135
|
# Image configuration
|
|
128
136
|
# image_src = /globe.svg
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import "server-only";
|
|
2
2
|
import { NextRequest } from "next/server";
|
|
3
3
|
import type { TenantAuthOptions, TenantAuthResult, RequiredTenantAuthResult } from "./auth_types";
|
|
4
|
+
/**
|
|
5
|
+
* Base cookie name for scope ID (will have prefix applied).
|
|
6
|
+
*
|
|
7
|
+
* Exported so a consuming app can SET the same cookie this module READS —
|
|
8
|
+
* without it, an app implementing a scope switcher has to duplicate the
|
|
9
|
+
* configured prefix and drift the moment it changes.
|
|
10
|
+
*/
|
|
11
|
+
export declare const SCOPE_COOKIE_BASE_NAME = "hazo_auth_scope_id";
|
|
12
|
+
/** The live, prefixed scope cookie name for this deployment. */
|
|
13
|
+
export declare function get_scope_cookie_name(): string;
|
|
4
14
|
/**
|
|
5
15
|
* Extracts scope ID from request headers or cookies
|
|
6
16
|
* Priority: Header > Cookie
|
|
@@ -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;AAQ1C,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,EAGzB,MAAM,cAAc,CAAC;
|
|
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;AAQ1C,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,EAGzB,MAAM,cAAc,CAAC;AActB;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,uBAAuB,CAAC;AAE3D,gEAAgE;AAChE,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAID;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,iBAAiB,GACzB,MAAM,GAAG,SAAS,CAYpB;AA8BD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,WAAW,EACpB,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,gBAAgB,CAAC,CAwF3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,WAAW,EACpB,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,wBAAwB,CAAC,CA0BnC"}
|
|
@@ -15,9 +15,17 @@ import { AuthenticationRequiredError, TenantRequiredError, TenantAccessDeniedErr
|
|
|
15
15
|
*/
|
|
16
16
|
const DEFAULT_SCOPE_HEADER = "X-Hazo-Scope-Id";
|
|
17
17
|
/**
|
|
18
|
-
* Base cookie name for scope ID (will have prefix applied)
|
|
18
|
+
* Base cookie name for scope ID (will have prefix applied).
|
|
19
|
+
*
|
|
20
|
+
* Exported so a consuming app can SET the same cookie this module READS —
|
|
21
|
+
* without it, an app implementing a scope switcher has to duplicate the
|
|
22
|
+
* configured prefix and drift the moment it changes.
|
|
19
23
|
*/
|
|
20
|
-
const
|
|
24
|
+
export const SCOPE_COOKIE_BASE_NAME = "hazo_auth_scope_id";
|
|
25
|
+
/** The live, prefixed scope cookie name for this deployment. */
|
|
26
|
+
export function get_scope_cookie_name() {
|
|
27
|
+
return get_cookie_name(SCOPE_COOKIE_BASE_NAME);
|
|
28
|
+
}
|
|
21
29
|
// section: helpers
|
|
22
30
|
/**
|
|
23
31
|
* Extracts scope ID from request headers or cookies
|
|
@@ -35,7 +43,7 @@ export function extract_scope_id_from_request(request, options) {
|
|
|
35
43
|
return header_value;
|
|
36
44
|
}
|
|
37
45
|
// Check cookie (with prefix)
|
|
38
|
-
const cookie_name = options.scope_cookie_name || get_cookie_name(
|
|
46
|
+
const cookie_name = options.scope_cookie_name || get_cookie_name(SCOPE_COOKIE_BASE_NAME);
|
|
39
47
|
const cookie_value = (_a = request.cookies.get(cookie_name)) === null || _a === void 0 ? void 0 : _a.value;
|
|
40
48
|
return cookie_value;
|
|
41
49
|
}
|
package/dist/lib/auth/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ 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
|
-
export { hazo_get_tenant_auth, require_tenant_auth, extract_scope_id_from_request, } from "./hazo_get_tenant_auth.server.js";
|
|
6
|
+
export { hazo_get_tenant_auth, require_tenant_auth, extract_scope_id_from_request, SCOPE_COOKIE_BASE_NAME, get_scope_cookie_name, } from "./hazo_get_tenant_auth.server.js";
|
|
7
7
|
export type { ScopeDetails, TenantOrganization, 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";
|
|
@@ -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,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,
|
|
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,EAC7B,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,+BAA+B,CAAC;AACvC,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,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,8BAA8B,EAC9B,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;AAG3E,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,wCAAwC,CAAC;AAChD,YAAY,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC"}
|
package/dist/lib/auth/index.js
CHANGED
|
@@ -7,7 +7,7 @@ export { get_authenticated_user, require_auth, is_authenticated, } from "./auth_
|
|
|
7
7
|
// section: anon_id_exports (v5.2)
|
|
8
8
|
export { ensure_anon_id } from "./ensure_anon_id.server.js";
|
|
9
9
|
// section: tenant_auth_exports
|
|
10
|
-
export { hazo_get_tenant_auth, require_tenant_auth, extract_scope_id_from_request, } from "./hazo_get_tenant_auth.server.js";
|
|
10
|
+
export { hazo_get_tenant_auth, require_tenant_auth, extract_scope_id_from_request, SCOPE_COOKIE_BASE_NAME, get_scope_cookie_name, } from "./hazo_get_tenant_auth.server.js";
|
|
11
11
|
export { HazoAuthError, AuthenticationRequiredError, TenantRequiredError, TenantAccessDeniedError, } from "./auth_types.js";
|
|
12
12
|
// section: client_exports
|
|
13
13
|
export { get_server_auth_user } from "./server_auth.js";
|
|
@@ -11,6 +11,8 @@ export declare const OTP_CONFIG_DEFAULTS: {
|
|
|
11
11
|
readonly max_verify_attempts: 5;
|
|
12
12
|
readonly auto_assign_scope_id: "00000000-0000-0000-0000-000000000001";
|
|
13
13
|
readonly auto_assign_role_name: "member";
|
|
14
|
+
readonly image_src: "/hazo_auth/images/login_default.jpg";
|
|
15
|
+
readonly image_alt: "Sign in with a one-time code";
|
|
14
16
|
};
|
|
15
17
|
export type OtpConfig = {
|
|
16
18
|
/** Whether to automatically register a new user when an unrecognised email requests an OTP */
|
|
@@ -35,6 +37,10 @@ export type OtpConfig = {
|
|
|
35
37
|
auto_assign_scope_id: string;
|
|
36
38
|
/** Role name to assign within the auto-assign scope */
|
|
37
39
|
auto_assign_role_name: string;
|
|
40
|
+
/** Image shown in the OTP page's visual panel */
|
|
41
|
+
image_src: string;
|
|
42
|
+
/** Alt text for the OTP page's visual panel image */
|
|
43
|
+
image_alt: string;
|
|
38
44
|
};
|
|
39
45
|
/**
|
|
40
46
|
* Reads OTP configuration from hazo_auth_config.ini [hazo_auth__otp] section.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otp_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/otp_config.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAMrB,eAAO,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"otp_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/otp_config.server.ts"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAMrB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;CAiBtB,CAAC;AAGX,MAAM,MAAM,SAAS,GAAG;IACtB,8FAA8F;IAC9F,aAAa,EAAE,OAAO,CAAC;IACvB,uDAAuD;IACvD,gBAAgB,EAAE,MAAM,CAAC;IACzB,qFAAqF;IACrF,mBAAmB,EAAE,MAAM,CAAC;IAC5B,oFAAoF;IACpF,yBAAyB,EAAE,MAAM,CAAC;IAClC,kFAAkF;IAClF,oBAAoB,EAAE,MAAM,CAAC;IAC7B,6DAA6D;IAC7D,+BAA+B,EAAE,MAAM,CAAC;IACxC,+EAA+E;IAC/E,iBAAiB,EAAE,MAAM,CAAC;IAC1B,0DAA0D;IAC1D,4BAA4B,EAAE,MAAM,CAAC;IACrC,wEAAwE;IACxE,mBAAmB,EAAE,MAAM,CAAC;IAC5B,6DAA6D;IAC7D,oBAAoB,EAAE,MAAM,CAAC;IAC7B,uDAAuD;IACvD,qBAAqB,EAAE,MAAM,CAAC;IAC9B,iDAAiD;IACjD,SAAS,EAAE,MAAM,CAAC;IAClB,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAGF;;;GAGG;AACH,wBAAgB,cAAc,IAAI,SAAS,CA+B1C;AAED;;;GAGG;AACH,wBAAgB,iCAAiC,IAAI,MAAM,CAE1D"}
|
|
@@ -16,6 +16,11 @@ export const OTP_CONFIG_DEFAULTS = {
|
|
|
16
16
|
max_verify_attempts: 5,
|
|
17
17
|
auto_assign_scope_id: "00000000-0000-0000-0000-000000000001",
|
|
18
18
|
auto_assign_role_name: "member",
|
|
19
|
+
// Matches OTPLayout's own default. Apps that never ran `npx hazo_auth init`
|
|
20
|
+
// (so have no public/hazo_auth/images/) should point this at the packaged
|
|
21
|
+
// asset route instead: /api/hazo_auth/assets/login_default.jpg
|
|
22
|
+
image_src: "/hazo_auth/images/login_default.jpg",
|
|
23
|
+
image_alt: "Sign in with a one-time code",
|
|
19
24
|
};
|
|
20
25
|
// section: helpers
|
|
21
26
|
/**
|
|
@@ -37,6 +42,8 @@ export function get_otp_config() {
|
|
|
37
42
|
max_verify_attempts: get_config_number(section, "otp_max_verify_attempts", d.max_verify_attempts),
|
|
38
43
|
auto_assign_scope_id: get_config_value(section, "otp_auto_assign_scope_id", d.auto_assign_scope_id),
|
|
39
44
|
auto_assign_role_name: get_config_value(section, "otp_auto_assign_role_name", d.auto_assign_role_name),
|
|
45
|
+
image_src: get_config_value(section, "otp_image_src", d.image_src),
|
|
46
|
+
image_alt: get_config_value(section, "otp_image_alt", d.image_alt),
|
|
40
47
|
};
|
|
41
48
|
}
|
|
42
49
|
/**
|
|
@@ -29,6 +29,17 @@ export type OTPPageProps = {
|
|
|
29
29
|
* with the brand panel on the left.
|
|
30
30
|
*/
|
|
31
31
|
theme?: import("../theme/theme_types").HazoAuthTheme;
|
|
32
|
+
/**
|
|
33
|
+
* Image shown in the visual panel beside the form.
|
|
34
|
+
* Falls back to `[hazo_auth__otp] otp_image_src` in hazo_auth_config.ini,
|
|
35
|
+
* then to the packaged default login illustration.
|
|
36
|
+
*/
|
|
37
|
+
image_src?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Alt text for the visual panel image.
|
|
40
|
+
* Falls back to `[hazo_auth__otp] otp_image_alt`, then to a packaged default.
|
|
41
|
+
*/
|
|
42
|
+
image_alt?: string;
|
|
32
43
|
};
|
|
33
44
|
/**
|
|
34
45
|
* Zero-config OTPPage server component
|
|
@@ -51,6 +62,6 @@ export type OTPPageProps = {
|
|
|
51
62
|
* @param props - Optional searchParams and title
|
|
52
63
|
* @returns Server-rendered OTP sign-in page
|
|
53
64
|
*/
|
|
54
|
-
export default function OTPPage({ searchParams, title, subtitle, ctaText, theme, }?: OTPPageProps): Promise<React.ReactElement>;
|
|
65
|
+
export default function OTPPage({ searchParams, title, subtitle, ctaText, theme, image_src, image_alt, }?: OTPPageProps): Promise<React.ReactElement>;
|
|
55
66
|
export { OTPPage };
|
|
56
67
|
//# sourceMappingURL=otp.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otp.d.ts","sourceRoot":"","sources":["../../src/server_pages/otp.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAGrB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"otp.d.ts","sourceRoot":"","sources":["../../src/server_pages/otp.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAGrB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,MAAM,MAAM,YAAY,GAAG;IACzB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAEtE;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,sBAAsB,EAAE,aAAa,CAAC;IAErD;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAA8B,OAAO,CAAC,EACpC,YAAY,EACZ,KAAK,EACL,QAAQ,EACR,OAAO,EACP,KAAK,EACL,SAAS,EACT,SAAS,GACV,GAAE,YAAiB,GAAG,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAqCjD;AAGD,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
package/dist/server_pages/otp.js
CHANGED
|
@@ -5,6 +5,7 @@ import "server-only";
|
|
|
5
5
|
import { OTPLayout } from "../components/layouts/otp/index.js";
|
|
6
6
|
import { AuthPageShell } from "../components/layouts/shared/components/auth_page_shell.js";
|
|
7
7
|
import { DEFAULT_STRINGS, readStrings } from "../strings.js";
|
|
8
|
+
import { get_otp_config } from "../lib/otp_config.server.js";
|
|
8
9
|
// section: component
|
|
9
10
|
/**
|
|
10
11
|
* Zero-config OTPPage server component
|
|
@@ -27,7 +28,7 @@ import { DEFAULT_STRINGS, readStrings } from "../strings.js";
|
|
|
27
28
|
* @param props - Optional searchParams and title
|
|
28
29
|
* @returns Server-rendered OTP sign-in page
|
|
29
30
|
*/
|
|
30
|
-
export default async function OTPPage({ searchParams, title, subtitle, ctaText, theme, } = {}) {
|
|
31
|
+
export default async function OTPPage({ searchParams, title, subtitle, ctaText, theme, image_src, image_alt, } = {}) {
|
|
31
32
|
var _a, _b, _c, _d;
|
|
32
33
|
const params = searchParams instanceof Promise
|
|
33
34
|
? await searchParams
|
|
@@ -39,7 +40,16 @@ export default async function OTPPage({ searchParams, title, subtitle, ctaText,
|
|
|
39
40
|
const resolved_title = (_b = title !== null && title !== void 0 ? title : otp_strings.title) !== null && _b !== void 0 ? _b : DEFAULT_STRINGS.otp.title;
|
|
40
41
|
const resolved_subtitle = (_c = subtitle !== null && subtitle !== void 0 ? subtitle : otp_strings.subtitle) !== null && _c !== void 0 ? _c : DEFAULT_STRINGS.otp.subtitle;
|
|
41
42
|
const resolved_cta = (_d = ctaText !== null && ctaText !== void 0 ? ctaText : otp_strings.ctaText) !== null && _d !== void 0 ? _d : DEFAULT_STRINGS.otp.ctaText;
|
|
42
|
-
|
|
43
|
+
// Resolve the visual-panel image: prop > [hazo_auth__otp] config > default.
|
|
44
|
+
// Without this the OTPLayout default (/hazo_auth/images/login_default.jpg)
|
|
45
|
+
// was unreachable from consuming apps, so any app that serves its auth
|
|
46
|
+
// images from somewhere else — e.g. the packaged /api/hazo_auth/assets/
|
|
47
|
+
// route rather than a copied-out public/ directory — rendered this page with
|
|
48
|
+
// an empty visual panel and a 404 in the console.
|
|
49
|
+
const otp_config = get_otp_config();
|
|
50
|
+
const resolved_image_src = image_src !== null && image_src !== void 0 ? image_src : otp_config.image_src;
|
|
51
|
+
const resolved_image_alt = image_alt !== null && image_alt !== void 0 ? image_alt : otp_config.image_alt;
|
|
52
|
+
return (_jsx(AuthPageShell, { children: _jsx(OTPLayout, { redirect_url: redirect_url, title: resolved_title, subtitle: resolved_subtitle, ctaText: resolved_cta, theme: theme, image_src: resolved_image_src, image_alt: resolved_image_alt }) }));
|
|
43
53
|
}
|
|
44
54
|
// Named export for direct imports
|
|
45
55
|
export { OTPPage };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hazo_auth",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.14.0",
|
|
4
4
|
"description": "Zero-config authentication UI components for Next.js with RBAC, OAuth, scope-based multi-tenancy, and invitations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"authentication",
|
|
@@ -224,6 +224,20 @@
|
|
|
224
224
|
"test:watch": "cross-env NODE_ENV=test jest --watch"
|
|
225
225
|
},
|
|
226
226
|
"dependencies": {
|
|
227
|
+
"@radix-ui/react-accordion": "^1.2.0",
|
|
228
|
+
"@radix-ui/react-alert-dialog": "^1.1.0",
|
|
229
|
+
"@radix-ui/react-avatar": "^1.1.0",
|
|
230
|
+
"@radix-ui/react-checkbox": "^1.3.0",
|
|
231
|
+
"@radix-ui/react-dialog": "^1.1.0",
|
|
232
|
+
"@radix-ui/react-dropdown-menu": "^2.1.0",
|
|
233
|
+
"@radix-ui/react-hover-card": "^1.1.0",
|
|
234
|
+
"@radix-ui/react-label": "^2.1.0",
|
|
235
|
+
"@radix-ui/react-select": "^2.2.0",
|
|
236
|
+
"@radix-ui/react-separator": "^1.1.0",
|
|
237
|
+
"@radix-ui/react-slot": "^1.2.0",
|
|
238
|
+
"@radix-ui/react-switch": "^1.2.0",
|
|
239
|
+
"@radix-ui/react-tabs": "^1.1.0",
|
|
240
|
+
"@radix-ui/react-tooltip": "^1.2.0",
|
|
227
241
|
"axios": "^1.13.2",
|
|
228
242
|
"browser-image-compression": "^2.0.2",
|
|
229
243
|
"class-variance-authority": "^0.7.1",
|
|
@@ -231,11 +245,15 @@
|
|
|
231
245
|
"date-fns": "^4.1.0",
|
|
232
246
|
"gravatar-url": "^4.0.1",
|
|
233
247
|
"ini": "^6.0.0",
|
|
248
|
+
"input-otp": "^1.4.0",
|
|
234
249
|
"jose": "^5.9.6",
|
|
235
250
|
"jsonwebtoken": "^9.0.2",
|
|
251
|
+
"lucide-react": "^0.553.0",
|
|
236
252
|
"mime-types": "^3.0.1",
|
|
253
|
+
"next-themes": "^0.4.0",
|
|
237
254
|
"react-markdown": "^10.1.0",
|
|
238
255
|
"server-only": "^0.0.1",
|
|
256
|
+
"sonner": "^2.0.7",
|
|
239
257
|
"tailwind-merge": "^3.5.0",
|
|
240
258
|
"tw-animate-css": "^1.4.0",
|
|
241
259
|
"zod": "^4.1.12"
|
|
@@ -252,21 +270,6 @@
|
|
|
252
270
|
"multer": "^2.0.2"
|
|
253
271
|
},
|
|
254
272
|
"peerDependencies": {
|
|
255
|
-
"@radix-ui/react-accordion": "^1.2.0",
|
|
256
|
-
"@radix-ui/react-alert-dialog": "^1.1.0",
|
|
257
|
-
"@radix-ui/react-avatar": "^1.1.0",
|
|
258
|
-
"@radix-ui/react-checkbox": "^1.3.0",
|
|
259
|
-
"@radix-ui/react-dialog": "^1.1.0",
|
|
260
|
-
"@radix-ui/react-dropdown-menu": "^2.1.0",
|
|
261
|
-
"@radix-ui/react-hover-card": "^1.1.0",
|
|
262
|
-
"@radix-ui/react-label": "^2.1.0",
|
|
263
|
-
"@radix-ui/react-select": "^2.2.0",
|
|
264
|
-
"@radix-ui/react-separator": "^1.1.0",
|
|
265
|
-
"@radix-ui/react-slot": "^1.2.0",
|
|
266
|
-
"@radix-ui/react-switch": "^1.2.0",
|
|
267
|
-
"@radix-ui/react-tabs": "^1.1.0",
|
|
268
|
-
"@radix-ui/react-tooltip": "^1.2.0",
|
|
269
|
-
"hazo_api": "^2.6.0",
|
|
270
273
|
"hazo_config": "^2.4.1",
|
|
271
274
|
"hazo_connect": "^3.9.2",
|
|
272
275
|
"hazo_core": "^1.3.0",
|
|
@@ -275,19 +278,12 @@
|
|
|
275
278
|
"hazo_secure": "^1.7.0",
|
|
276
279
|
"hazo_theme": "^1.0.1",
|
|
277
280
|
"hazo_ui": "^6.3.1",
|
|
278
|
-
"input-otp": "^1.4.0",
|
|
279
|
-
"lucide-react": "^0.553.0",
|
|
280
281
|
"next": "^14.0.0 || ^15.0.0 || ^16.0.0",
|
|
281
282
|
"next-auth": "^4.24.0",
|
|
282
|
-
"next-themes": "^0.4.0",
|
|
283
283
|
"react": "^18.0.0 || ^19.0.0",
|
|
284
|
-
"react-dom": "^18.0.0 || ^19.0.0"
|
|
285
|
-
"sonner": "^2.0.7"
|
|
284
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
286
285
|
},
|
|
287
286
|
"peerDependenciesMeta": {
|
|
288
|
-
"hazo_api": {
|
|
289
|
-
"optional": true
|
|
290
|
-
},
|
|
291
287
|
"hazo_config": {
|
|
292
288
|
"optional": false
|
|
293
289
|
},
|
|
@@ -311,60 +307,6 @@
|
|
|
311
307
|
},
|
|
312
308
|
"hazo_ui": {
|
|
313
309
|
"optional": true
|
|
314
|
-
},
|
|
315
|
-
"next-themes": {
|
|
316
|
-
"optional": true
|
|
317
|
-
},
|
|
318
|
-
"sonner": {
|
|
319
|
-
"optional": true
|
|
320
|
-
},
|
|
321
|
-
"@radix-ui/react-accordion": {
|
|
322
|
-
"optional": true
|
|
323
|
-
},
|
|
324
|
-
"@radix-ui/react-alert-dialog": {
|
|
325
|
-
"optional": true
|
|
326
|
-
},
|
|
327
|
-
"@radix-ui/react-avatar": {
|
|
328
|
-
"optional": true
|
|
329
|
-
},
|
|
330
|
-
"@radix-ui/react-checkbox": {
|
|
331
|
-
"optional": true
|
|
332
|
-
},
|
|
333
|
-
"@radix-ui/react-dialog": {
|
|
334
|
-
"optional": true
|
|
335
|
-
},
|
|
336
|
-
"@radix-ui/react-dropdown-menu": {
|
|
337
|
-
"optional": true
|
|
338
|
-
},
|
|
339
|
-
"@radix-ui/react-hover-card": {
|
|
340
|
-
"optional": true
|
|
341
|
-
},
|
|
342
|
-
"@radix-ui/react-label": {
|
|
343
|
-
"optional": true
|
|
344
|
-
},
|
|
345
|
-
"@radix-ui/react-select": {
|
|
346
|
-
"optional": true
|
|
347
|
-
},
|
|
348
|
-
"@radix-ui/react-separator": {
|
|
349
|
-
"optional": true
|
|
350
|
-
},
|
|
351
|
-
"@radix-ui/react-slot": {
|
|
352
|
-
"optional": true
|
|
353
|
-
},
|
|
354
|
-
"@radix-ui/react-switch": {
|
|
355
|
-
"optional": true
|
|
356
|
-
},
|
|
357
|
-
"@radix-ui/react-tabs": {
|
|
358
|
-
"optional": true
|
|
359
|
-
},
|
|
360
|
-
"@radix-ui/react-tooltip": {
|
|
361
|
-
"optional": true
|
|
362
|
-
},
|
|
363
|
-
"lucide-react": {
|
|
364
|
-
"optional": true
|
|
365
|
-
},
|
|
366
|
-
"input-otp": {
|
|
367
|
-
"optional": true
|
|
368
310
|
}
|
|
369
311
|
},
|
|
370
312
|
"devDependencies": {
|
|
@@ -411,13 +353,13 @@
|
|
|
411
353
|
"eslint-config-next": "^16.0.4",
|
|
412
354
|
"eslint-plugin-storybook": "^10.0.6",
|
|
413
355
|
"hazo_api": "^2.6.0",
|
|
414
|
-
"hazo_config": "^2.4.
|
|
415
|
-
"hazo_connect": "^3.
|
|
416
|
-
"hazo_core": "^1.3.
|
|
417
|
-
"hazo_logs": "^2.
|
|
418
|
-
"hazo_notify": "^6.1.
|
|
419
|
-
"hazo_theme": "^1.0
|
|
420
|
-
"hazo_ui": "^6.
|
|
356
|
+
"hazo_config": "^2.4.2",
|
|
357
|
+
"hazo_connect": "^3.10.1",
|
|
358
|
+
"hazo_core": "^1.3.1",
|
|
359
|
+
"hazo_logs": "^2.2.0",
|
|
360
|
+
"hazo_notify": "^6.1.5",
|
|
361
|
+
"hazo_theme": "^1.3.0",
|
|
362
|
+
"hazo_ui": "^6.8.0",
|
|
421
363
|
"input-otp": "^1.4.0",
|
|
422
364
|
"jest": "^30.2.0",
|
|
423
365
|
"jest-environment-jsdom": "^30.0.0",
|