hazo_auth 6.1.1 → 7.0.1
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 +163 -8
- package/SETUP_CHECKLIST.md +148 -0
- package/cli-src/lib/auth/nextauth_config.ts +101 -1
- package/cli-src/lib/email_verification_config.server.ts +0 -34
- package/cli-src/lib/forgot_password_config.server.ts +0 -34
- package/cli-src/lib/login_config.server.ts +0 -31
- package/cli-src/lib/my_settings_config.server.ts +0 -3
- package/cli-src/lib/oauth_config.server.ts +58 -0
- package/cli-src/lib/register_config.server.ts +11 -31
- package/cli-src/lib/reset_password_config.server.ts +0 -31
- package/cli-src/lib/services/oauth_service.ts +197 -0
- package/config/hazo_auth_config.example.ini +38 -41
- package/dist/components/layouts/create_firm/index.d.ts +4 -8
- package/dist/components/layouts/create_firm/index.d.ts.map +1 -1
- package/dist/components/layouts/create_firm/index.js +3 -3
- package/dist/components/layouts/email_verification/index.d.ts +4 -5
- 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 +4 -5
- 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/login/index.d.ts +13 -9
- package/dist/components/layouts/login/index.d.ts.map +1 -1
- package/dist/components/layouts/login/index.js +12 -6
- package/dist/components/layouts/otp/index.d.ts +8 -1
- package/dist/components/layouts/otp/index.d.ts.map +1 -1
- package/dist/components/layouts/otp/index.js +4 -2
- package/dist/components/layouts/register/index.d.ts +11 -7
- package/dist/components/layouts/register/index.d.ts.map +1 -1
- package/dist/components/layouts/register/index.js +8 -4
- package/dist/components/layouts/reset_password/index.d.ts +4 -5
- 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/components/already_logged_in_guard.d.ts +3 -5
- package/dist/components/layouts/shared/components/already_logged_in_guard.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/already_logged_in_guard.js +2 -2
- package/dist/components/layouts/shared/components/facebook_sign_in_button.d.ts +25 -0
- package/dist/components/layouts/shared/components/facebook_sign_in_button.d.ts.map +1 -0
- package/dist/components/layouts/shared/components/facebook_sign_in_button.js +49 -0
- package/dist/components/layouts/shared/components/sidebar_layout_wrapper.js +1 -1
- package/dist/components/layouts/shared/components/two_column_auth_layout.d.ts +3 -6
- package/dist/components/layouts/shared/components/two_column_auth_layout.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/two_column_auth_layout.js +8 -5
- package/dist/consent/consent_state.d.ts +18 -0
- package/dist/consent/consent_state.d.ts.map +1 -0
- package/dist/consent/consent_state.js +29 -0
- package/dist/consent/cookie_consent_banner.d.ts +11 -0
- package/dist/consent/cookie_consent_banner.d.ts.map +1 -0
- package/dist/consent/cookie_consent_banner.js +40 -0
- package/dist/consent/gtm_mapping.d.ts +13 -0
- package/dist/consent/gtm_mapping.d.ts.map +1 -0
- package/dist/consent/gtm_mapping.js +30 -0
- package/dist/consent/index.d.ts +7 -0
- package/dist/consent/index.d.ts.map +1 -0
- package/dist/consent/index.js +7 -0
- package/dist/consent/manage_modal.d.ts +2 -0
- package/dist/consent/manage_modal.d.ts.map +1 -0
- package/dist/consent/manage_modal.js +33 -0
- package/dist/consent/read_consent.d.ts +15 -0
- package/dist/consent/read_consent.d.ts.map +1 -0
- package/dist/consent/read_consent.js +23 -0
- package/dist/consent/use_consent.d.ts +7 -0
- package/dist/consent/use_consent.d.ts.map +1 -0
- package/dist/consent/use_consent.js +55 -0
- package/dist/lib/auth/nextauth_config.d.ts +10 -0
- package/dist/lib/auth/nextauth_config.d.ts.map +1 -1
- package/dist/lib/auth/nextauth_config.js +80 -2
- package/dist/lib/email_verification_config.server.d.ts +0 -3
- package/dist/lib/email_verification_config.server.d.ts.map +1 -1
- package/dist/lib/email_verification_config.server.js +0 -15
- package/dist/lib/forgot_password_config.server.d.ts +0 -3
- package/dist/lib/forgot_password_config.server.d.ts.map +1 -1
- package/dist/lib/forgot_password_config.server.js +0 -15
- package/dist/lib/login_config.server.d.ts +0 -3
- package/dist/lib/login_config.server.d.ts.map +1 -1
- package/dist/lib/login_config.server.js +0 -13
- package/dist/lib/my_settings_config.server.d.ts +0 -1
- package/dist/lib/my_settings_config.server.d.ts.map +1 -1
- package/dist/lib/my_settings_config.server.js +0 -2
- package/dist/lib/oauth_config.server.d.ts +17 -0
- package/dist/lib/oauth_config.server.d.ts.map +1 -1
- package/dist/lib/oauth_config.server.js +25 -0
- package/dist/lib/register_config.server.d.ts +2 -3
- package/dist/lib/register_config.server.d.ts.map +1 -1
- package/dist/lib/register_config.server.js +4 -13
- package/dist/lib/reset_password_config.server.d.ts +0 -3
- package/dist/lib/reset_password_config.server.d.ts.map +1 -1
- package/dist/lib/reset_password_config.server.js +0 -13
- package/dist/lib/services/oauth_service.d.ts +24 -0
- package/dist/lib/services/oauth_service.d.ts.map +1 -1
- package/dist/lib/services/oauth_service.js +155 -0
- package/dist/page_components/create_firm.d.ts +13 -1
- package/dist/page_components/create_firm.d.ts.map +1 -1
- package/dist/page_components/create_firm.js +10 -6
- package/dist/page_components/forgot_password.d.ts +1 -4
- package/dist/page_components/forgot_password.d.ts.map +1 -1
- package/dist/page_components/forgot_password.js +2 -6
- package/dist/page_components/login.d.ts +1 -4
- package/dist/page_components/login.d.ts.map +1 -1
- package/dist/page_components/login.js +2 -6
- package/dist/page_components/register.d.ts +1 -4
- package/dist/page_components/register.d.ts.map +1 -1
- package/dist/page_components/register.js +2 -6
- package/dist/page_components/reset_password.d.ts +1 -4
- package/dist/page_components/reset_password.d.ts.map +1 -1
- package/dist/page_components/reset_password.js +2 -6
- package/dist/page_components/verify_email.d.ts +1 -4
- package/dist/page_components/verify_email.d.ts.map +1 -1
- package/dist/page_components/verify_email.js +2 -6
- package/dist/server/routes/index.d.ts +1 -0
- package/dist/server/routes/index.d.ts.map +1 -1
- package/dist/server/routes/index.js +1 -0
- package/dist/server/routes/oauth_facebook_callback.d.ts +8 -0
- package/dist/server/routes/oauth_facebook_callback.d.ts.map +1 -0
- package/dist/server/routes/oauth_facebook_callback.js +157 -0
- package/dist/server/routes/oauth_google_callback.js +1 -1
- package/dist/server_pages/forgot_password.d.ts +13 -17
- package/dist/server_pages/forgot_password.d.ts.map +1 -1
- package/dist/server_pages/forgot_password.js +12 -8
- package/dist/server_pages/forgot_password_client_wrapper.d.ts +7 -6
- 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/login.d.ts +22 -21
- package/dist/server_pages/login.d.ts.map +1 -1
- package/dist/server_pages/login.js +15 -19
- package/dist/server_pages/login_client_wrapper.d.ts +10 -6
- package/dist/server_pages/login_client_wrapper.d.ts.map +1 -1
- package/dist/server_pages/login_client_wrapper.js +2 -2
- package/dist/server_pages/my_settings.d.ts +2 -0
- package/dist/server_pages/my_settings.d.ts.map +1 -1
- package/dist/server_pages/my_settings.js +8 -2
- package/dist/server_pages/otp.d.ts +16 -2
- package/dist/server_pages/otp.d.ts.map +1 -1
- package/dist/server_pages/otp.js +10 -3
- package/dist/server_pages/register.d.ts +19 -16
- package/dist/server_pages/register.d.ts.map +1 -1
- package/dist/server_pages/register.js +15 -12
- package/dist/server_pages/register_client_wrapper.d.ts +10 -6
- 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 +11 -16
- package/dist/server_pages/reset_password.d.ts.map +1 -1
- package/dist/server_pages/reset_password.js +11 -9
- package/dist/server_pages/reset_password_client_wrapper.d.ts +7 -6
- 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 +11 -17
- package/dist/server_pages/verify_email.d.ts.map +1 -1
- package/dist/server_pages/verify_email.js +11 -8
- package/dist/server_pages/verify_email_client_wrapper.d.ts +7 -6
- 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/strings/default_strings.d.ts +47 -0
- package/dist/strings/default_strings.d.ts.map +1 -0
- package/dist/strings/default_strings.js +18 -0
- package/dist/strings/index.d.ts +4 -0
- package/dist/strings/index.d.ts.map +1 -0
- package/dist/strings/index.js +3 -0
- package/dist/strings/strings_context.d.ts +12 -0
- package/dist/strings/strings_context.d.ts.map +1 -0
- package/dist/strings/strings_context.js +23 -0
- package/dist/strings/strings_provider.d.ts +26 -0
- package/dist/strings/strings_provider.d.ts.map +1 -0
- package/dist/strings/strings_provider.js +45 -0
- package/dist/theme/create_theme.d.ts +7 -0
- package/dist/theme/create_theme.d.ts.map +1 -0
- package/dist/theme/create_theme.js +97 -0
- package/dist/theme/hex_to_hsl.d.ts +16 -0
- package/dist/theme/hex_to_hsl.d.ts.map +1 -0
- package/dist/theme/hex_to_hsl.js +110 -0
- package/dist/theme/index.d.ts +4 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +3 -0
- package/dist/theme/luminance.d.ts +11 -0
- package/dist/theme/luminance.d.ts.map +1 -0
- package/dist/theme/luminance.js +45 -0
- package/dist/theme/theme_provider.d.ts +14 -0
- package/dist/theme/theme_provider.d.ts.map +1 -0
- package/dist/theme/theme_provider.js +23 -0
- package/dist/theme/theme_types.d.ts +36 -0
- package/dist/theme/theme_types.d.ts.map +1 -0
- package/dist/theme/theme_types.js +1 -0
- package/dist/themes/index.d.ts +3 -0
- package/dist/themes/index.d.ts.map +1 -0
- package/dist/themes/index.js +2 -0
- package/dist/themes/preset_indigo_sunset.d.ts +3 -0
- package/dist/themes/preset_indigo_sunset.d.ts.map +1 -0
- package/dist/themes/preset_indigo_sunset.js +20 -0
- package/dist/themes/preset_neutral.d.ts +3 -0
- package/dist/themes/preset_neutral.d.ts.map +1 -0
- package/dist/themes/preset_neutral.js +14 -0
- package/package.json +19 -2
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
// file_description: Custom OAuth callback handler that creates hazo_auth session after Facebook sign-in
|
|
2
|
+
// section: imports
|
|
3
|
+
import { NextResponse } from "next/server";
|
|
4
|
+
import { getToken } from "next-auth/jwt";
|
|
5
|
+
import { create_app_logger } from "../../lib/app_logger.js";
|
|
6
|
+
import { create_session_token } from "../../lib/services/session_token_service.js";
|
|
7
|
+
import { get_filename, get_line_number } from "../../lib/utils/api_route_helpers.js";
|
|
8
|
+
import { get_login_config } from "../../lib/login_config.server.js";
|
|
9
|
+
import { get_cookie_name, get_cookie_options, BASE_COOKIE_NAMES } from "../../lib/cookies_config.server.js";
|
|
10
|
+
import { get_hazo_connect_instance } from "../../lib/hazo_connect_instance.server.js";
|
|
11
|
+
import { get_post_login_redirect } from "../../lib/services/post_verification_service.js";
|
|
12
|
+
import { get_oauth_config } from "../../lib/oauth_config.server.js";
|
|
13
|
+
import { rewrite_request_for_proxy } from "../../lib/utils/proxy_request.js";
|
|
14
|
+
// section: api_handler
|
|
15
|
+
/**
|
|
16
|
+
* Handles the OAuth callback after Facebook sign-in
|
|
17
|
+
* The user creation/linking is done in NextAuth signIn callback
|
|
18
|
+
* This route just sets the hazo_auth session cookies
|
|
19
|
+
*/
|
|
20
|
+
export async function facebookCallbackGET(original_request) {
|
|
21
|
+
// Rewrite request.url to public origin when behind a reverse proxy.
|
|
22
|
+
const request = rewrite_request_for_proxy(original_request);
|
|
23
|
+
const logger = create_app_logger();
|
|
24
|
+
// Detect if request came through HTTPS proxy (Cloudflare tunnel, etc.)
|
|
25
|
+
const is_secure = original_request.headers.get("x-forwarded-proto") === "https" ||
|
|
26
|
+
request.url.startsWith("https://");
|
|
27
|
+
// Resolve the configured sign-in page up-front so early error redirects
|
|
28
|
+
// honour [hazo_auth__oauth] sign_in_page just like the success path.
|
|
29
|
+
const sign_in_page = get_oauth_config().sign_in_page;
|
|
30
|
+
try {
|
|
31
|
+
// Get the NextAuth token from the session
|
|
32
|
+
const token = (await getToken({
|
|
33
|
+
req: request,
|
|
34
|
+
secureCookie: is_secure,
|
|
35
|
+
}));
|
|
36
|
+
logger.debug("facebook_callback_token_received", {
|
|
37
|
+
filename: get_filename(),
|
|
38
|
+
line_number: get_line_number(),
|
|
39
|
+
has_token: !!token,
|
|
40
|
+
has_email: !!(token === null || token === void 0 ? void 0 : token.email),
|
|
41
|
+
has_hazo_user_id: !!(token === null || token === void 0 ? void 0 : token.hazo_user_id),
|
|
42
|
+
});
|
|
43
|
+
if (!token) {
|
|
44
|
+
logger.warn("facebook_callback_no_token", {
|
|
45
|
+
filename: get_filename(),
|
|
46
|
+
line_number: get_line_number(),
|
|
47
|
+
note: "No NextAuth token found - user may not have completed Facebook sign-in",
|
|
48
|
+
});
|
|
49
|
+
const login_url = new URL(sign_in_page, request.url);
|
|
50
|
+
login_url.searchParams.set("error", "oauth_failed");
|
|
51
|
+
return NextResponse.redirect(login_url.toString());
|
|
52
|
+
}
|
|
53
|
+
// Validate we have the required data
|
|
54
|
+
if (!token.email || !token.hazo_user_id) {
|
|
55
|
+
logger.warn("facebook_callback_missing_data", {
|
|
56
|
+
filename: get_filename(),
|
|
57
|
+
line_number: get_line_number(),
|
|
58
|
+
has_email: !!token.email,
|
|
59
|
+
has_hazo_user_id: !!token.hazo_user_id,
|
|
60
|
+
});
|
|
61
|
+
const login_url = new URL(sign_in_page, request.url);
|
|
62
|
+
login_url.searchParams.set("error", "oauth_incomplete");
|
|
63
|
+
return NextResponse.redirect(login_url.toString());
|
|
64
|
+
}
|
|
65
|
+
const user_id = token.hazo_user_id;
|
|
66
|
+
const email = token.email;
|
|
67
|
+
logger.debug("facebook_callback_success", {
|
|
68
|
+
filename: get_filename(),
|
|
69
|
+
line_number: get_line_number(),
|
|
70
|
+
user_id,
|
|
71
|
+
email,
|
|
72
|
+
});
|
|
73
|
+
// Get redirect URL based on user's scope/invitation status
|
|
74
|
+
const loginConfig = get_login_config();
|
|
75
|
+
const oauthConfig = get_oauth_config();
|
|
76
|
+
// Per-request override: same `?next=` pattern as Google callback.
|
|
77
|
+
const raw_next = request.nextUrl.searchParams.get("next");
|
|
78
|
+
const safe_next = raw_next &&
|
|
79
|
+
raw_next.startsWith("/") &&
|
|
80
|
+
!raw_next.startsWith("//") &&
|
|
81
|
+
!/^[a-z][a-z0-9+.\-]*:/i.test(raw_next)
|
|
82
|
+
? raw_next
|
|
83
|
+
: null;
|
|
84
|
+
// Check if user needs onboarding
|
|
85
|
+
const hazoConnect = get_hazo_connect_instance();
|
|
86
|
+
const { redirect_url: determined_redirect, needs_onboarding, invitation_check_skipped, invitation_table_error, } = await get_post_login_redirect(hazoConnect, user_id, email, {
|
|
87
|
+
default_redirect: safe_next || oauthConfig.default_redirect || loginConfig.redirectRoute || "/",
|
|
88
|
+
create_firm_url: oauthConfig.create_firm_url,
|
|
89
|
+
skip_invitation_check: oauthConfig.skip_invitation_check,
|
|
90
|
+
no_scope_redirect: safe_next || oauthConfig.no_scope_redirect,
|
|
91
|
+
});
|
|
92
|
+
// Log warning if invitation table is missing
|
|
93
|
+
if (invitation_table_error) {
|
|
94
|
+
logger.warn("invitation_table_missing", {
|
|
95
|
+
filename: get_filename(),
|
|
96
|
+
line_number: get_line_number(),
|
|
97
|
+
user_id,
|
|
98
|
+
email,
|
|
99
|
+
note: "hazo_invitations table does not exist - run migration or set skip_invitation_check=true in [hazo_auth__oauth]",
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
logger.debug("facebook_callback_post_login_redirect", {
|
|
103
|
+
filename: get_filename(),
|
|
104
|
+
line_number: get_line_number(),
|
|
105
|
+
user_id,
|
|
106
|
+
email,
|
|
107
|
+
redirect_url: determined_redirect,
|
|
108
|
+
needs_onboarding,
|
|
109
|
+
invitation_check_skipped,
|
|
110
|
+
invitation_table_error,
|
|
111
|
+
});
|
|
112
|
+
// Create redirect response
|
|
113
|
+
const redirect_url = new URL(determined_redirect, request.url);
|
|
114
|
+
const response = NextResponse.redirect(redirect_url.toString());
|
|
115
|
+
// Set authentication cookies
|
|
116
|
+
const base_cookie_options = {
|
|
117
|
+
httpOnly: true,
|
|
118
|
+
secure: process.env.NODE_ENV === "production" || is_secure,
|
|
119
|
+
sameSite: "lax",
|
|
120
|
+
path: "/",
|
|
121
|
+
maxAge: 60 * 60 * 24 * 30, // 30 days
|
|
122
|
+
};
|
|
123
|
+
const cookie_options = get_cookie_options(base_cookie_options);
|
|
124
|
+
response.cookies.set(get_cookie_name(BASE_COOKIE_NAMES.USER_ID), user_id, cookie_options);
|
|
125
|
+
response.cookies.set(get_cookie_name(BASE_COOKIE_NAMES.USER_EMAIL), email, cookie_options);
|
|
126
|
+
// Create and set JWT session token
|
|
127
|
+
try {
|
|
128
|
+
const session_token = await create_session_token(user_id, email);
|
|
129
|
+
response.cookies.set(get_cookie_name(BASE_COOKIE_NAMES.SESSION), session_token, cookie_options);
|
|
130
|
+
}
|
|
131
|
+
catch (token_error) {
|
|
132
|
+
const token_error_message = token_error instanceof Error ? token_error.message : "Unknown error";
|
|
133
|
+
logger.warn("facebook_callback_session_token_creation_failed", {
|
|
134
|
+
filename: get_filename(),
|
|
135
|
+
line_number: get_line_number(),
|
|
136
|
+
user_id,
|
|
137
|
+
email,
|
|
138
|
+
error: token_error_message,
|
|
139
|
+
note: "OAuth login succeeded but session token creation failed - using legacy cookies",
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
return response;
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
const error_message = error instanceof Error ? error.message : "Unknown error";
|
|
146
|
+
const error_stack = error instanceof Error ? error.stack : undefined;
|
|
147
|
+
logger.error("facebook_callback_error", {
|
|
148
|
+
filename: get_filename(),
|
|
149
|
+
line_number: get_line_number(),
|
|
150
|
+
error_message,
|
|
151
|
+
error_stack,
|
|
152
|
+
});
|
|
153
|
+
const login_url = new URL(sign_in_page, request.url);
|
|
154
|
+
login_url.searchParams.set("error", "oauth_error");
|
|
155
|
+
return NextResponse.redirect(login_url.toString());
|
|
156
|
+
}
|
|
157
|
+
}
|
|
@@ -172,7 +172,7 @@ export async function GET(original_request) {
|
|
|
172
172
|
error_message,
|
|
173
173
|
error_stack,
|
|
174
174
|
});
|
|
175
|
-
const login_url = new URL(
|
|
175
|
+
const login_url = new URL(sign_in_page, request.url);
|
|
176
176
|
login_url.searchParams.set("error", "oauth_error");
|
|
177
177
|
return NextResponse.redirect(login_url.toString());
|
|
178
178
|
}
|
|
@@ -1,21 +1,5 @@
|
|
|
1
1
|
import "server-only";
|
|
2
|
-
import type { StaticImageData } from "next/image";
|
|
3
2
|
export type ForgotPasswordPageProps = {
|
|
4
|
-
/**
|
|
5
|
-
* Optional image source for the visual panel
|
|
6
|
-
* Defaults from hazo_auth_config.ini or package default image
|
|
7
|
-
*/
|
|
8
|
-
image_src?: string | StaticImageData;
|
|
9
|
-
/**
|
|
10
|
-
* Optional image alt text
|
|
11
|
-
* Defaults to "Password recovery illustration"
|
|
12
|
-
*/
|
|
13
|
-
image_alt?: string;
|
|
14
|
-
/**
|
|
15
|
-
* Optional image background color
|
|
16
|
-
* Defaults to "#f1f5f9"
|
|
17
|
-
*/
|
|
18
|
-
image_background_color?: string;
|
|
19
3
|
/**
|
|
20
4
|
* Optional sign in path
|
|
21
5
|
* Defaults from DEFAULT_FORGOT_PASSWORD.loginPath
|
|
@@ -26,6 +10,18 @@ export type ForgotPasswordPageProps = {
|
|
|
26
10
|
* Defaults from DEFAULT_FORGOT_PASSWORD.loginLabel
|
|
27
11
|
*/
|
|
28
12
|
sign_in_label?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Optional theme that controls visual appearance and layout mode.
|
|
15
|
+
* When `theme.layout` is `"split"`, activates the two-column split layout
|
|
16
|
+
* with the brand panel on the left.
|
|
17
|
+
*/
|
|
18
|
+
theme?: import("../theme/theme_types").HazoAuthTheme;
|
|
19
|
+
/** Override the page heading. Falls back to HazoAuthStringsProvider → DEFAULT_STRINGS. */
|
|
20
|
+
title?: string;
|
|
21
|
+
/** Override the page subtitle. Falls back to HazoAuthStringsProvider → DEFAULT_STRINGS. */
|
|
22
|
+
subtitle?: string;
|
|
23
|
+
/** Override the submit button label. Falls back to HazoAuthStringsProvider → DEFAULT_STRINGS. */
|
|
24
|
+
ctaText?: string;
|
|
29
25
|
};
|
|
30
26
|
/**
|
|
31
27
|
* Zero-config ForgotPasswordPage server component
|
|
@@ -47,7 +43,7 @@ export type ForgotPasswordPageProps = {
|
|
|
47
43
|
*
|
|
48
44
|
* Zero configuration required - works out of the box!
|
|
49
45
|
*
|
|
50
|
-
* @param props - Optional
|
|
46
|
+
* @param props - Optional navigation customization props
|
|
51
47
|
* @returns Server-rendered forgot password page
|
|
52
48
|
*/
|
|
53
49
|
export default function ForgotPasswordPage(props: ForgotPasswordPageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forgot_password.d.ts","sourceRoot":"","sources":["../../src/server_pages/forgot_password.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"forgot_password.d.ts","sourceRoot":"","sources":["../../src/server_pages/forgot_password.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAUrB,MAAM,MAAM,uBAAuB,GAAG;IACpC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,sBAAsB,EAAE,aAAa,CAAC;IACrD,0FAA0F;IAC1F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iGAAiG;IACjG,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,2CAoCxE;AAGD,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -7,6 +7,7 @@ import { get_forgot_password_config } from "../lib/forgot_password_config.server
|
|
|
7
7
|
import { ForgotPasswordClientWrapper } from "./forgot_password_client_wrapper.js";
|
|
8
8
|
import { AuthPageShell } from "../components/layouts/shared/components/auth_page_shell.js";
|
|
9
9
|
import { DEFAULT_FORGOT_PASSWORD } from "../lib/config/default_config.js";
|
|
10
|
+
import { DEFAULT_STRINGS, readStrings } from "../strings.js";
|
|
10
11
|
// section: component
|
|
11
12
|
/**
|
|
12
13
|
* Zero-config ForgotPasswordPage server component
|
|
@@ -28,19 +29,22 @@ import { DEFAULT_FORGOT_PASSWORD } from "../lib/config/default_config.js";
|
|
|
28
29
|
*
|
|
29
30
|
* Zero configuration required - works out of the box!
|
|
30
31
|
*
|
|
31
|
-
* @param props - Optional
|
|
32
|
+
* @param props - Optional navigation customization props
|
|
32
33
|
* @returns Server-rendered forgot password page
|
|
33
34
|
*/
|
|
34
35
|
export default function ForgotPasswordPage(props) {
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
var _a, _b, _c;
|
|
37
|
+
const { sign_in_path = DEFAULT_FORGOT_PASSWORD.loginPath, sign_in_label = DEFAULT_FORGOT_PASSWORD.loginLabel, theme, title, subtitle, ctaText, } = props !== null && props !== void 0 ? props : {};
|
|
38
|
+
// Resolve strings: prop > HazoAuthStringsProvider > DEFAULT_STRINGS
|
|
39
|
+
const strings = readStrings();
|
|
40
|
+
const fp_strings = strings.forgot_password;
|
|
41
|
+
const resolved_title = (_a = title !== null && title !== void 0 ? title : fp_strings.title) !== null && _a !== void 0 ? _a : DEFAULT_STRINGS.forgot_password.title;
|
|
42
|
+
const resolved_subtitle = (_b = subtitle !== null && subtitle !== void 0 ? subtitle : fp_strings.subtitle) !== null && _b !== void 0 ? _b : DEFAULT_STRINGS.forgot_password.subtitle;
|
|
43
|
+
const resolved_cta = (_c = ctaText !== null && ctaText !== void 0 ? ctaText : fp_strings.ctaText) !== null && _c !== void 0 ? _c : DEFAULT_STRINGS.forgot_password.ctaText;
|
|
44
|
+
// Load configuration from INI file (with defaults)
|
|
37
45
|
const config = get_forgot_password_config();
|
|
38
|
-
// Use props if provided, otherwise fall back to config (which includes default asset image)
|
|
39
|
-
const finalImageSrc = image_src || config.imageSrc;
|
|
40
|
-
const finalImageAlt = image_alt || config.imageAlt;
|
|
41
|
-
const finalImageBackgroundColor = image_background_color || config.imageBackgroundColor;
|
|
42
46
|
// Pass serializable config to client wrapper, wrapped in AuthPageShell for navbar support
|
|
43
|
-
return (_jsx(AuthPageShell, { children: _jsx(ForgotPasswordClientWrapper, {
|
|
47
|
+
return (_jsx(AuthPageShell, { children: _jsx(ForgotPasswordClientWrapper, { 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, theme: theme, labels: { heading: resolved_title, subHeading: resolved_subtitle, submitButton: resolved_cta } }) }));
|
|
44
48
|
}
|
|
45
49
|
// Named export for direct imports
|
|
46
50
|
export { ForgotPasswordPage };
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import type { ForgotPasswordConfig } from "../lib/forgot_password_config.server";
|
|
2
|
-
import type {
|
|
3
|
-
export type ForgotPasswordClientWrapperProps =
|
|
4
|
-
image_src: string | StaticImageData;
|
|
5
|
-
image_alt: string;
|
|
6
|
-
image_background_color: string;
|
|
2
|
+
import type { HazoAuthTheme } from "../theme/theme_types";
|
|
3
|
+
export type ForgotPasswordClientWrapperProps = ForgotPasswordConfig & {
|
|
7
4
|
sign_in_path: string;
|
|
8
5
|
sign_in_label: string;
|
|
6
|
+
/** Optional theme passed through to ForgotPasswordLayout → TwoColumnAuthLayout. */
|
|
7
|
+
theme?: HazoAuthTheme;
|
|
8
|
+
/** Optional label overrides (heading, subHeading, submitButton) */
|
|
9
|
+
labels?: import("../components/layouts/shared/config/layout_customization").LayoutLabelOverrides;
|
|
9
10
|
};
|
|
10
11
|
/**
|
|
11
12
|
* Client wrapper for ForgotPasswordLayout
|
|
12
13
|
* Initializes hazo_connect data client on client side and passes config from server
|
|
13
14
|
*/
|
|
14
|
-
export declare function ForgotPasswordClientWrapper({
|
|
15
|
+
export declare function ForgotPasswordClientWrapper({ sign_in_path, sign_in_label, alreadyLoggedInMessage, showLogoutButton, showReturnHomeButton, returnHomeButtonLabel, returnHomePath, theme, labels, }: ForgotPasswordClientWrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
15
16
|
//# 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;
|
|
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,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG1D,MAAM,MAAM,gCAAgC,GAAG,oBAAoB,GAAG;IACpE,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,mFAAmF;IACnF,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,mEAAmE;IACnE,MAAM,CAAC,EAAE,OAAO,0DAA0D,EAAE,oBAAoB,CAAC;CAClG,CAAC;AAGF;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,EAC1C,YAAY,EACZ,aAAa,EACb,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,EACd,KAAK,EACL,MAAM,GACP,EAAE,gCAAgC,2CAkClC"}
|
|
@@ -11,7 +11,7 @@ import { create_sqlite_hazo_connect } from "../lib/hazo_connect_setup.js";
|
|
|
11
11
|
* Client wrapper for ForgotPasswordLayout
|
|
12
12
|
* Initializes hazo_connect data client on client side and passes config from server
|
|
13
13
|
*/
|
|
14
|
-
export function ForgotPasswordClientWrapper({
|
|
14
|
+
export function ForgotPasswordClientWrapper({ sign_in_path, sign_in_label, alreadyLoggedInMessage, showLogoutButton, showReturnHomeButton, returnHomeButtonLabel, returnHomePath, theme, labels, }) {
|
|
15
15
|
const [dataClient, setDataClient] = useState(null);
|
|
16
16
|
useEffect(() => {
|
|
17
17
|
// Initialize hazo_connect on client side
|
|
@@ -23,5 +23,5 @@ export function ForgotPasswordClientWrapper({ image_src, image_alt, image_backgr
|
|
|
23
23
|
if (!dataClient) {
|
|
24
24
|
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: "Loading..." }) }));
|
|
25
25
|
}
|
|
26
|
-
return (_jsx(ForgotPasswordLayout, {
|
|
26
|
+
return (_jsx(ForgotPasswordLayout, { 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, theme: theme, labels: labels }));
|
|
27
27
|
}
|
|
@@ -1,33 +1,34 @@
|
|
|
1
1
|
import "server-only";
|
|
2
|
-
import type
|
|
2
|
+
import type React from "react";
|
|
3
3
|
export type LoginPageProps = {
|
|
4
|
-
/**
|
|
5
|
-
* Optional image source for the visual panel
|
|
6
|
-
* Defaults from hazo_auth_config.ini or package default image
|
|
7
|
-
*/
|
|
8
|
-
image_src?: string | StaticImageData;
|
|
9
|
-
/**
|
|
10
|
-
* Optional image alt text
|
|
11
|
-
* Defaults to "Secure login illustration"
|
|
12
|
-
*/
|
|
13
|
-
image_alt?: string;
|
|
14
|
-
/**
|
|
15
|
-
* Optional image background color
|
|
16
|
-
* Defaults to "#f1f5f9"
|
|
17
|
-
*/
|
|
18
|
-
image_background_color?: string;
|
|
19
4
|
/**
|
|
20
5
|
* Layout mode (default: `"two_column"`).
|
|
21
6
|
* - `"two_column"` — full server-rendered page with the package's
|
|
22
|
-
* TwoColumnAuthLayout
|
|
23
|
-
* the
|
|
7
|
+
* TwoColumnAuthLayout wrapped in the standalone AuthPageShell.
|
|
8
|
+
* Layout appearance is now controlled by the theme (split or centered).
|
|
24
9
|
* - `"form_only"` — emits just the form content (no AuthPageShell, no
|
|
25
10
|
* TwoColumnAuthLayout). Use when wrapping the form in your own brand
|
|
26
|
-
* chrome
|
|
27
|
-
* `image_src` / `image_alt` / `image_background_color` are ignored in
|
|
28
|
-
* this mode.
|
|
11
|
+
* chrome.
|
|
29
12
|
*/
|
|
30
13
|
layout?: "two_column" | "form_only";
|
|
14
|
+
/**
|
|
15
|
+
* Optional theme that controls visual appearance and layout mode.
|
|
16
|
+
* When `theme.layout` is `"split"`, activates the two-column split layout
|
|
17
|
+
* with the brand panel on the left.
|
|
18
|
+
*/
|
|
19
|
+
theme?: import("../theme/theme_types").HazoAuthTheme;
|
|
20
|
+
/** Override the page heading. Falls back to HazoAuthStringsProvider → DEFAULT_STRINGS. */
|
|
21
|
+
title?: string;
|
|
22
|
+
/** Override the page subtitle. Falls back to HazoAuthStringsProvider → DEFAULT_STRINGS. */
|
|
23
|
+
subtitle?: string;
|
|
24
|
+
/** Override the submit button label. Falls back to HazoAuthStringsProvider → DEFAULT_STRINGS. */
|
|
25
|
+
ctaText?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Optional legal text rendered below the form.
|
|
28
|
+
* Accepts a string or JSX (e.g. `<a href="/tos">Terms of Service</a>`).
|
|
29
|
+
* Falls back to HazoAuthStringsProvider → DEFAULT_STRINGS.
|
|
30
|
+
*/
|
|
31
|
+
legalText?: React.ReactNode;
|
|
31
32
|
};
|
|
32
33
|
/**
|
|
33
34
|
* Zero-config LoginPage server component
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/server_pages/login.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/server_pages/login.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAIrB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,MAAM,MAAM,cAAc,GAAG;IAC3B;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,YAAY,GAAG,WAAW,CAAC;IACpC;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,sBAAsB,EAAE,aAAa,CAAC;IACrD,0FAA0F;IAC1F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iGAAiG;IACjG,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,KAAK,EAAE,cAAc,2CAkEtD;AAGD,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -2,12 +2,12 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
// file_description: Zero-config LoginPage server component - drop in and use with no configuration required
|
|
3
3
|
// section: server-only-guard
|
|
4
4
|
import "server-only";
|
|
5
|
-
// section: imports
|
|
6
5
|
import { get_login_config } from "../lib/login_config.server.js";
|
|
7
6
|
import { get_navbar_config } from "../lib/navbar_config.server.js";
|
|
8
7
|
import { LoginClientWrapper } from "./login_client_wrapper.js";
|
|
9
8
|
import { AuthPageShell } from "../components/layouts/shared/components/auth_page_shell.js";
|
|
10
9
|
import { FloatingHomeLink } from "../components/layouts/shared/components/floating_home_link.js";
|
|
10
|
+
import { DEFAULT_STRINGS, readStrings } from "../strings.js";
|
|
11
11
|
// section: component
|
|
12
12
|
/**
|
|
13
13
|
* Zero-config LoginPage server component
|
|
@@ -33,29 +33,25 @@ import { FloatingHomeLink } from "../components/layouts/shared/components/floati
|
|
|
33
33
|
* @returns Server-rendered login page
|
|
34
34
|
*/
|
|
35
35
|
export default function LoginPage(props) {
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
var _a, _b, _c;
|
|
37
|
+
const { layout = "two_column", theme, title, subtitle, ctaText, legalText, } = props !== null && props !== void 0 ? props : {};
|
|
38
|
+
// Resolve strings: prop > HazoAuthStringsProvider > DEFAULT_STRINGS
|
|
39
|
+
const strings = readStrings();
|
|
40
|
+
const login_strings = strings.login;
|
|
41
|
+
const resolved_title = (_a = title !== null && title !== void 0 ? title : login_strings.title) !== null && _a !== void 0 ? _a : DEFAULT_STRINGS.login.title;
|
|
42
|
+
const resolved_subtitle = (_b = subtitle !== null && subtitle !== void 0 ? subtitle : login_strings.subtitle) !== null && _b !== void 0 ? _b : DEFAULT_STRINGS.login.subtitle;
|
|
43
|
+
const resolved_cta = (_c = ctaText !== null && ctaText !== void 0 ? ctaText : login_strings.ctaText) !== null && _c !== void 0 ? _c : DEFAULT_STRINGS.login.ctaText;
|
|
44
|
+
const resolved_legal = legalText !== undefined ? legalText : (login_strings.legalText || undefined);
|
|
45
|
+
// Load configuration from INI file (with defaults)
|
|
38
46
|
const config = get_login_config();
|
|
39
|
-
|
|
40
|
-
const finalImageSrc = image_src || config.imageSrc;
|
|
41
|
-
const finalImageAlt = image_alt || config.imageAlt;
|
|
42
|
-
const finalImageBackgroundColor = image_background_color || config.imageBackgroundColor;
|
|
43
|
-
const wrapper = (_jsx(LoginClientWrapper, { image_src: finalImageSrc, image_alt: finalImageAlt, image_background_color: finalImageBackgroundColor, redirectRoute: config.redirectRoute, successMessage: config.successMessage, alreadyLoggedInMessage: config.alreadyLoggedInMessage, showLogoutButton: config.showLogoutButton, showReturnHomeButton: config.showReturnHomeButton, returnHomeButtonLabel: config.returnHomeButtonLabel, returnHomePath: config.returnHomePath, forgotPasswordPath: config.forgotPasswordPath, forgotPasswordLabel: config.forgotPasswordLabel, createAccountPath: config.createAccountPath, createAccountLabel: config.createAccountLabel, showCreateAccountLink: config.showCreateAccountLink, oauth: {
|
|
47
|
+
const wrapper = (_jsx(LoginClientWrapper, { redirectRoute: config.redirectRoute, successMessage: config.successMessage, alreadyLoggedInMessage: config.alreadyLoggedInMessage, showLogoutButton: config.showLogoutButton, showReturnHomeButton: config.showReturnHomeButton, returnHomeButtonLabel: config.returnHomeButtonLabel, returnHomePath: config.returnHomePath, forgotPasswordPath: config.forgotPasswordPath, forgotPasswordLabel: config.forgotPasswordLabel, createAccountPath: config.createAccountPath, createAccountLabel: config.createAccountLabel, showCreateAccountLink: config.showCreateAccountLink, oauth: {
|
|
44
48
|
enable_google: config.oauth.enable_google,
|
|
45
49
|
enable_email_password: config.oauth.enable_email_password,
|
|
46
50
|
google_button_text: config.oauth.google_button_text,
|
|
47
51
|
oauth_divider_text: config.oauth.oauth_divider_text,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
// wrapper interfering. Two-column mode keeps the existing AuthPageShell
|
|
52
|
-
// wrap for navbar/centering support.
|
|
53
|
-
//
|
|
54
|
-
// The navbar config's home_link is also surfaced here in form_only mode
|
|
55
|
-
// so users mid-auth-flow always have a way out — without this, the only
|
|
56
|
-
// exit is the browser back button. Rendered as a fixed-position "Back to
|
|
57
|
-
// home" pill (top-left). Disabled by setting `[hazo_auth__navbar]
|
|
58
|
-
// show_home_link = false` or by hiding it CSS-side at the consumer.
|
|
52
|
+
enable_facebook: config.oauth.enable_facebook,
|
|
53
|
+
facebook_button_text: config.oauth.facebook_button_text,
|
|
54
|
+
}, otpSigninEnabled: config.otpSigninEnabled, otpSigninLabel: config.otpSigninLabel, otpSigninHref: config.otpSigninHref, layout: layout, theme: theme, labels: { heading: resolved_title, subHeading: resolved_subtitle, submitButton: resolved_cta }, legalText: resolved_legal }));
|
|
59
55
|
if (layout === "form_only") {
|
|
60
56
|
const navbar = get_navbar_config();
|
|
61
57
|
return (_jsxs(_Fragment, { children: [navbar.show_home_link && (_jsx(FloatingHomeLink, { path: navbar.home_path, label: navbar.home_label })), wrapper] }));
|
|
@@ -1,20 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import type { LoginConfig } from "../lib/login_config.server";
|
|
2
3
|
import type { OAuthLayoutConfig } from "../components/layouts/login/index";
|
|
3
|
-
import type {
|
|
4
|
-
export type LoginClientWrapperProps = Omit<LoginConfig, '
|
|
5
|
-
image_src?: string | StaticImageData;
|
|
6
|
-
image_alt?: string;
|
|
7
|
-
image_background_color?: string;
|
|
4
|
+
import type { HazoAuthTheme } from "../theme/theme_types";
|
|
5
|
+
export type LoginClientWrapperProps = Omit<LoginConfig, 'oauth' | 'showCreateAccountLink'> & {
|
|
8
6
|
/** Show/hide "Create account" link (default: true) */
|
|
9
7
|
showCreateAccountLink?: boolean;
|
|
10
8
|
/** OAuth configuration */
|
|
11
9
|
oauth?: OAuthLayoutConfig;
|
|
12
10
|
/** Layout mode — see LoginLayoutProps.layout. Default `"two_column"`. */
|
|
13
11
|
layout?: "two_column" | "form_only";
|
|
12
|
+
/** Optional theme passed through to LoginLayout → TwoColumnAuthLayout. */
|
|
13
|
+
theme?: HazoAuthTheme;
|
|
14
|
+
/** Optional label overrides (heading, subHeading, submitButton) */
|
|
15
|
+
labels?: import("../components/layouts/shared/config/layout_customization").LayoutLabelOverrides;
|
|
16
|
+
/** Optional legal text rendered below the form (accepts ReactNode for links/JSX) */
|
|
17
|
+
legalText?: React.ReactNode;
|
|
14
18
|
};
|
|
15
19
|
/**
|
|
16
20
|
* Client wrapper for LoginLayout
|
|
17
21
|
* Initializes hazo_connect data client on client side and passes config from server
|
|
18
22
|
*/
|
|
19
|
-
export declare function LoginClientWrapper({
|
|
23
|
+
export declare function LoginClientWrapper({ redirectRoute, successMessage, alreadyLoggedInMessage, showLogoutButton, showReturnHomeButton, returnHomeButtonLabel, returnHomePath, forgotPasswordPath, forgotPasswordLabel, createAccountPath, createAccountLabel, showCreateAccountLink, oauth, otpSigninEnabled, otpSigninLabel, otpSigninHref, layout, theme, labels, legalText, }: LoginClientWrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
20
24
|
//# sourceMappingURL=login_client_wrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login_client_wrapper.d.ts","sourceRoot":"","sources":["../../src/server_pages/login_client_wrapper.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"login_client_wrapper.d.ts","sourceRoot":"","sources":["../../src/server_pages/login_client_wrapper.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAKnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG1D,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,uBAAuB,CAAC,GAAG;IAC3F,sDAAsD;IACtD,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,0BAA0B;IAC1B,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B,yEAAyE;IACzE,MAAM,CAAC,EAAE,YAAY,GAAG,WAAW,CAAC;IACpC,0EAA0E;IAC1E,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,mEAAmE;IACnE,MAAM,CAAC,EAAE,OAAO,0DAA0D,EAAE,oBAAoB,CAAC;IACjG,oFAAoF;IACpF,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B,CAAC;AAGF;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,qBAA4B,EAC5B,KAAK,EACL,gBAAwB,EACxB,cAA0C,EAC1C,aAAgC,EAChC,MAAqB,EACrB,KAAK,EACL,MAAM,EACN,SAAS,GACV,EAAE,uBAAuB,2CA6CzB"}
|
|
@@ -11,7 +11,7 @@ import { create_sqlite_hazo_connect } from "../lib/hazo_connect_setup.js";
|
|
|
11
11
|
* Client wrapper for LoginLayout
|
|
12
12
|
* Initializes hazo_connect data client on client side and passes config from server
|
|
13
13
|
*/
|
|
14
|
-
export function LoginClientWrapper({
|
|
14
|
+
export function LoginClientWrapper({ redirectRoute, successMessage, alreadyLoggedInMessage, showLogoutButton, showReturnHomeButton, returnHomeButtonLabel, returnHomePath, forgotPasswordPath, forgotPasswordLabel, createAccountPath, createAccountLabel, showCreateAccountLink = true, oauth, otpSigninEnabled = false, otpSigninLabel = "Sign in with email code", otpSigninHref = "/hazo_auth/otp", layout = "two_column", theme, labels, legalText, }) {
|
|
15
15
|
const [dataClient, setDataClient] = useState(null);
|
|
16
16
|
useEffect(() => {
|
|
17
17
|
// Initialize hazo_connect on client side
|
|
@@ -23,5 +23,5 @@ export function LoginClientWrapper({ image_src, image_alt, image_background_colo
|
|
|
23
23
|
if (!dataClient) {
|
|
24
24
|
return (_jsx("div", { className: "cls_login_page_loading flex items-center justify-center min-h-screen", children: _jsx("div", { className: "text-slate-600 animate-pulse", children: "Loading..." }) }));
|
|
25
25
|
}
|
|
26
|
-
return (_jsx(LoginLayout, {
|
|
26
|
+
return (_jsx(LoginLayout, { data_client: dataClient, redirectRoute: redirectRoute, successMessage: successMessage, alreadyLoggedInMessage: alreadyLoggedInMessage, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: returnHomeButtonLabel, returnHomePath: returnHomePath, forgot_password_path: forgotPasswordPath, forgot_password_label: forgotPasswordLabel, create_account_path: createAccountPath, create_account_label: createAccountLabel, show_create_account_link: showCreateAccountLink, oauth: oauth, otp_signin_enabled: otpSigninEnabled, otp_signin_label: otpSigninLabel, otp_signin_href: otpSigninHref, layout: layout, theme: theme, labels: labels, legalText: legalText }));
|
|
27
27
|
}
|
|
@@ -4,6 +4,8 @@ export type MySettingsPageProps = {
|
|
|
4
4
|
* Optional className for custom styling
|
|
5
5
|
*/
|
|
6
6
|
className?: string;
|
|
7
|
+
/** Override the page heading. Falls back to HazoAuthStringsProvider → DEFAULT_STRINGS. */
|
|
8
|
+
title?: string;
|
|
7
9
|
};
|
|
8
10
|
/**
|
|
9
11
|
* Zero-config MySettingsPage server component
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"my_settings.d.ts","sourceRoot":"","sources":["../../src/server_pages/my_settings.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"my_settings.d.ts","sourceRoot":"","sources":["../../src/server_pages/my_settings.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AASrB,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0FAA0F;IAC1F,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,KAAK,EAAE,mBAAmB,2CAuChE;AAGD,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -6,6 +6,7 @@ import "server-only";
|
|
|
6
6
|
import { get_my_settings_config } from "../lib/my_settings_config.server.js";
|
|
7
7
|
import MySettingsLayout from "../components/layouts/my_settings/index.js";
|
|
8
8
|
import { AuthPageShell } from "../components/layouts/shared/components/auth_page_shell.js";
|
|
9
|
+
import { DEFAULT_STRINGS, readStrings } from "../strings.js";
|
|
9
10
|
// section: component
|
|
10
11
|
/**
|
|
11
12
|
* Zero-config MySettingsPage server component
|
|
@@ -53,11 +54,16 @@ import { AuthPageShell } from "../components/layouts/shared/components/auth_page
|
|
|
53
54
|
* @returns Server-rendered my settings component
|
|
54
55
|
*/
|
|
55
56
|
export default function MySettingsPage(props) {
|
|
56
|
-
|
|
57
|
+
var _a;
|
|
58
|
+
const { className, title } = props !== null && props !== void 0 ? props : {};
|
|
59
|
+
// Resolve strings: prop > HazoAuthStringsProvider > DEFAULT_STRINGS
|
|
60
|
+
const strings = readStrings();
|
|
61
|
+
const ms_strings = strings.my_settings;
|
|
62
|
+
const resolved_title = (_a = title !== null && title !== void 0 ? title : ms_strings.title) !== null && _a !== void 0 ? _a : DEFAULT_STRINGS.my_settings.title;
|
|
57
63
|
// Load configuration from INI file (with defaults)
|
|
58
64
|
const config = get_my_settings_config();
|
|
59
65
|
// Render layout with all server-initialized configuration, wrapped in AuthPageShell for navbar support
|
|
60
|
-
return (_jsx(AuthPageShell, { children: _jsx(MySettingsLayout, { className: className, password_requirements: config.passwordRequirements, profilePicture: config.profilePicture, userFields: config.userFields, unauthorizedMessage: config.unauthorizedMessage, loginButtonLabel: config.loginButtonLabel, loginPath: config.loginPath, heading:
|
|
66
|
+
return (_jsx(AuthPageShell, { children: _jsx(MySettingsLayout, { className: className, password_requirements: config.passwordRequirements, profilePicture: config.profilePicture, userFields: config.userFields, unauthorizedMessage: config.unauthorizedMessage, loginButtonLabel: config.loginButtonLabel, loginPath: config.loginPath, heading: resolved_title, subHeading: config.subHeading, profilePhotoLabel: config.profilePhotoLabel, profilePhotoRecommendation: config.profilePhotoRecommendation, uploadPhotoButtonLabel: config.uploadPhotoButtonLabel, removePhotoButtonLabel: config.removePhotoButtonLabel, profileInformationLabel: config.profileInformationLabel, passwordLabel: config.passwordLabel, currentPasswordLabel: config.currentPasswordLabel, newPasswordLabel: config.newPasswordLabel, confirmPasswordLabel: config.confirmPasswordLabel, messages: config.messages, uiSizes: config.uiSizes, fileTypes: config.fileTypes }) }));
|
|
61
67
|
}
|
|
62
68
|
// Named export for direct imports
|
|
63
69
|
export { MySettingsPage };
|
|
@@ -12,9 +12,23 @@ export type OTPPageProps = {
|
|
|
12
12
|
};
|
|
13
13
|
/**
|
|
14
14
|
* Page heading passed through to OTPLayout.
|
|
15
|
-
*
|
|
15
|
+
* Falls back to HazoAuthStringsProvider → DEFAULT_STRINGS.
|
|
16
16
|
*/
|
|
17
17
|
title?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Page subtitle. Falls back to HazoAuthStringsProvider → DEFAULT_STRINGS.
|
|
20
|
+
*/
|
|
21
|
+
subtitle?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Submit button label. Falls back to HazoAuthStringsProvider → DEFAULT_STRINGS.
|
|
24
|
+
*/
|
|
25
|
+
ctaText?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Optional theme that controls visual appearance and layout mode.
|
|
28
|
+
* When `theme.layout` is `"split"`, activates the two-column split layout
|
|
29
|
+
* with the brand panel on the left.
|
|
30
|
+
*/
|
|
31
|
+
theme?: import("../theme/theme_types").HazoAuthTheme;
|
|
18
32
|
};
|
|
19
33
|
/**
|
|
20
34
|
* Zero-config OTPPage server component
|
|
@@ -37,6 +51,6 @@ export type OTPPageProps = {
|
|
|
37
51
|
* @param props - Optional searchParams and title
|
|
38
52
|
* @returns Server-rendered OTP sign-in page
|
|
39
53
|
*/
|
|
40
|
-
export default function OTPPage({ searchParams, title, }?: OTPPageProps): Promise<React.ReactElement>;
|
|
54
|
+
export default function OTPPage({ searchParams, title, subtitle, ctaText, theme, }?: OTPPageProps): Promise<React.ReactElement>;
|
|
41
55
|
export { OTPPage };
|
|
42
56
|
//# 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;AAM/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;CACtD,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAA8B,OAAO,CAAC,EACpC,YAAY,EACZ,KAAK,EACL,QAAQ,EACR,OAAO,EACP,KAAK,GACN,GAAE,YAAiB,GAAG,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAyBjD;AAGD,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
package/dist/server_pages/otp.js
CHANGED
|
@@ -4,6 +4,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
4
4
|
import "server-only";
|
|
5
5
|
import { OTPLayout } from "../components/layouts/otp.js";
|
|
6
6
|
import { AuthPageShell } from "../components/layouts/shared/components/auth_page_shell.js";
|
|
7
|
+
import { DEFAULT_STRINGS, readStrings } from "../strings.js";
|
|
7
8
|
// section: component
|
|
8
9
|
/**
|
|
9
10
|
* Zero-config OTPPage server component
|
|
@@ -26,13 +27,19 @@ import { AuthPageShell } from "../components/layouts/shared/components/auth_page
|
|
|
26
27
|
* @param props - Optional searchParams and title
|
|
27
28
|
* @returns Server-rendered OTP sign-in page
|
|
28
29
|
*/
|
|
29
|
-
export default async function OTPPage({ searchParams, title, } = {}) {
|
|
30
|
-
var _a;
|
|
30
|
+
export default async function OTPPage({ searchParams, title, subtitle, ctaText, theme, } = {}) {
|
|
31
|
+
var _a, _b, _c, _d;
|
|
31
32
|
const params = searchParams instanceof Promise
|
|
32
33
|
? await searchParams
|
|
33
34
|
: (searchParams !== null && searchParams !== void 0 ? searchParams : {});
|
|
34
35
|
const redirect_url = (_a = params.redirect) !== null && _a !== void 0 ? _a : "/";
|
|
35
|
-
|
|
36
|
+
// Resolve strings: prop > HazoAuthStringsProvider > DEFAULT_STRINGS
|
|
37
|
+
const strings = readStrings();
|
|
38
|
+
const otp_strings = strings.otp;
|
|
39
|
+
const resolved_title = (_b = title !== null && title !== void 0 ? title : otp_strings.title) !== null && _b !== void 0 ? _b : DEFAULT_STRINGS.otp.title;
|
|
40
|
+
const resolved_subtitle = (_c = subtitle !== null && subtitle !== void 0 ? subtitle : otp_strings.subtitle) !== null && _c !== void 0 ? _c : DEFAULT_STRINGS.otp.subtitle;
|
|
41
|
+
const resolved_cta = (_d = ctaText !== null && ctaText !== void 0 ? ctaText : otp_strings.ctaText) !== null && _d !== void 0 ? _d : DEFAULT_STRINGS.otp.ctaText;
|
|
42
|
+
return (_jsx(AuthPageShell, { children: _jsx(OTPLayout, { redirect_url: redirect_url, title: resolved_title, subtitle: resolved_subtitle, ctaText: resolved_cta, theme: theme }) }));
|
|
36
43
|
}
|
|
37
44
|
// Named export for direct imports
|
|
38
45
|
export { OTPPage };
|