hazo_auth 1.6.6 → 3.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 +212 -12
- package/SETUP_CHECKLIST.md +81 -1
- package/dist/app/api/hazo_auth/login/route.d.ts.map +1 -1
- package/dist/app/api/hazo_auth/login/route.js +25 -0
- package/dist/app/api/hazo_auth/logout/route.d.ts.map +1 -1
- package/dist/app/api/hazo_auth/logout/route.js +5 -0
- package/dist/components/layouts/email_verification/hooks/use_email_verification.d.ts.map +1 -1
- package/dist/components/layouts/email_verification/hooks/use_email_verification.js +5 -3
- package/dist/components/layouts/email_verification/index.d.ts +2 -1
- package/dist/components/layouts/email_verification/index.d.ts.map +1 -1
- package/dist/components/layouts/forgot_password/hooks/use_forgot_password_form.d.ts.map +1 -1
- package/dist/components/layouts/forgot_password/hooks/use_forgot_password_form.js +3 -1
- package/dist/components/layouts/forgot_password/index.d.ts +2 -1
- package/dist/components/layouts/forgot_password/index.d.ts.map +1 -1
- package/dist/components/layouts/login/hooks/use_login_form.d.ts.map +1 -1
- package/dist/components/layouts/login/hooks/use_login_form.js +3 -1
- package/dist/components/layouts/login/index.d.ts +2 -1
- package/dist/components/layouts/login/index.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/components/profile_picture_dialog.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/components/profile_picture_dialog.js +3 -1
- package/dist/components/layouts/my_settings/components/profile_picture_library_tab.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/components/profile_picture_library_tab.js +4 -2
- package/dist/components/layouts/my_settings/hooks/use_my_settings.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/hooks/use_my_settings.js +7 -5
- package/dist/components/layouts/my_settings/index.d.ts +2 -1
- package/dist/components/layouts/my_settings/index.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/index.js +3 -2
- package/dist/components/layouts/register/hooks/use_register_form.d.ts.map +1 -1
- package/dist/components/layouts/register/hooks/use_register_form.js +37 -7
- package/dist/components/layouts/register/index.d.ts +2 -1
- package/dist/components/layouts/register/index.d.ts.map +1 -1
- package/dist/components/layouts/reset_password/hooks/use_reset_password_form.d.ts.map +1 -1
- package/dist/components/layouts/reset_password/hooks/use_reset_password_form.js +4 -2
- package/dist/components/layouts/reset_password/index.d.ts +2 -1
- package/dist/components/layouts/reset_password/index.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/already_logged_in_guard.d.ts +2 -1
- package/dist/components/layouts/shared/components/already_logged_in_guard.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/logout_button.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/logout_button.js +3 -1
- package/dist/components/layouts/shared/components/profile_pic_menu.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/profile_pic_menu.js +8 -4
- package/dist/components/layouts/shared/components/two_column_auth_layout.d.ts +2 -1
- package/dist/components/layouts/shared/components/two_column_auth_layout.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/visual_panel.d.ts +2 -1
- package/dist/components/layouts/shared/components/visual_panel.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/visual_panel.js +2 -1
- package/dist/components/layouts/shared/hooks/use_auth_status.d.ts.map +1 -1
- package/dist/components/layouts/shared/hooks/use_auth_status.js +4 -2
- package/dist/components/layouts/shared/hooks/use_hazo_auth.d.ts.map +1 -1
- package/dist/components/layouts/shared/hooks/use_hazo_auth.js +4 -2
- package/dist/components/layouts/shared/index.d.ts +0 -2
- package/dist/components/layouts/shared/index.d.ts.map +1 -1
- package/dist/components/layouts/shared/index.js +2 -2
- package/dist/components/layouts/user_management/components/roles_matrix.d.ts.map +1 -1
- package/dist/components/layouts/user_management/components/roles_matrix.js +8 -6
- package/dist/components/layouts/user_management/index.d.ts.map +1 -1
- package/dist/components/layouts/user_management/index.js +15 -13
- package/dist/contexts/hazo_auth_config.d.ts +18 -0
- package/dist/contexts/hazo_auth_config.d.ts.map +1 -0
- package/dist/contexts/hazo_auth_config.js +10 -0
- package/dist/contexts/hazo_auth_provider.d.ts +73 -0
- package/dist/contexts/hazo_auth_provider.d.ts.map +1 -0
- package/dist/contexts/hazo_auth_provider.js +82 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/lib/auth/hazo_get_auth.server.d.ts.map +1 -1
- package/dist/lib/auth/hazo_get_auth.server.js +31 -3
- package/dist/lib/auth/session_token_validator.edge.d.ts +15 -0
- package/dist/lib/auth/session_token_validator.edge.d.ts.map +1 -0
- package/dist/lib/auth/session_token_validator.edge.js +64 -0
- package/dist/lib/config/default_config.d.ts +237 -0
- package/dist/lib/config/default_config.d.ts.map +1 -0
- package/dist/lib/config/default_config.js +159 -0
- package/dist/lib/email_verification_config.server.d.ts +4 -0
- package/dist/lib/email_verification_config.server.d.ts.map +1 -1
- package/dist/lib/email_verification_config.server.js +12 -0
- package/dist/lib/forgot_password_config.server.d.ts +4 -0
- package/dist/lib/forgot_password_config.server.d.ts.map +1 -1
- package/dist/lib/forgot_password_config.server.js +12 -0
- package/dist/lib/login_config.server.d.ts +4 -0
- package/dist/lib/login_config.server.d.ts.map +1 -1
- package/dist/lib/login_config.server.js +10 -0
- package/dist/lib/password_requirements_config.server.d.ts +1 -1
- package/dist/lib/password_requirements_config.server.d.ts.map +1 -1
- package/dist/lib/password_requirements_config.server.js +8 -7
- package/dist/lib/register_config.server.d.ts +4 -0
- package/dist/lib/register_config.server.d.ts.map +1 -1
- package/dist/lib/register_config.server.js +10 -0
- package/dist/lib/reset_password_config.server.d.ts +4 -0
- package/dist/lib/reset_password_config.server.d.ts.map +1 -1
- package/dist/lib/reset_password_config.server.js +10 -0
- package/dist/lib/services/session_token_service.d.ts +27 -0
- package/dist/lib/services/session_token_service.d.ts.map +1 -0
- package/dist/lib/services/session_token_service.js +130 -0
- package/dist/page_components/forgot_password.d.ts.map +1 -1
- package/dist/page_components/forgot_password.js +14 -0
- package/dist/page_components/login.d.ts +4 -0
- package/dist/page_components/login.d.ts.map +1 -1
- package/dist/page_components/login.js +14 -0
- package/dist/page_components/register.d.ts.map +1 -1
- package/dist/page_components/register.js +14 -0
- package/dist/page_components/reset_password.d.ts.map +1 -1
- package/dist/page_components/reset_password.js +14 -0
- package/dist/page_components/verify_email.d.ts.map +1 -1
- package/dist/page_components/verify_email.js +14 -0
- package/dist/pages/forgot_password.d.ts +52 -0
- package/dist/pages/forgot_password.d.ts.map +1 -0
- package/dist/pages/forgot_password.js +41 -0
- package/dist/pages/index.d.ts +33 -0
- package/dist/pages/index.d.ts.map +1 -0
- package/dist/pages/index.js +28 -0
- package/dist/pages/login.d.ts +43 -0
- package/dist/pages/login.d.ts.map +1 -0
- package/dist/pages/login.js +45 -0
- package/dist/pages/my_settings.d.ts +54 -0
- package/dist/pages/my_settings.d.ts.map +1 -0
- package/dist/pages/my_settings.js +57 -0
- package/dist/pages/register.d.ts +44 -0
- package/dist/pages/register.d.ts.map +1 -0
- package/dist/pages/register.js +46 -0
- package/dist/pages/reset_password.d.ts +43 -0
- package/dist/pages/reset_password.d.ts.map +1 -0
- package/dist/pages/reset_password.js +42 -0
- package/dist/pages/verify_email.d.ts +52 -0
- package/dist/pages/verify_email.d.ts.map +1 -0
- package/dist/pages/verify_email.js +41 -0
- package/dist/server/middleware.d.ts +3 -0
- package/dist/server/middleware.d.ts.map +1 -0
- package/dist/server/middleware.js +5 -0
- package/dist/server_pages/forgot_password.d.ts +53 -0
- package/dist/server_pages/forgot_password.d.ts.map +1 -0
- package/dist/server_pages/forgot_password.js +40 -0
- package/dist/server_pages/forgot_password_client_wrapper.d.ts +15 -0
- package/dist/server_pages/forgot_password_client_wrapper.d.ts.map +1 -0
- package/dist/server_pages/forgot_password_client_wrapper.js +27 -0
- package/dist/server_pages/index.d.ts +13 -0
- package/dist/server_pages/index.d.ts.map +1 -0
- package/dist/server_pages/index.js +7 -0
- package/dist/server_pages/login.d.ts +43 -0
- package/dist/server_pages/login.d.ts.map +1 -0
- package/dist/server_pages/login.js +39 -0
- package/dist/server_pages/login_client_wrapper.d.ts +13 -0
- package/dist/server_pages/login_client_wrapper.d.ts.map +1 -0
- package/dist/server_pages/login_client_wrapper.js +29 -0
- package/dist/server_pages/my_settings.d.ts +53 -0
- package/dist/server_pages/my_settings.d.ts.map +1 -0
- package/dist/server_pages/my_settings.js +57 -0
- package/dist/server_pages/register.d.ts +45 -0
- package/dist/server_pages/register.d.ts.map +1 -0
- package/dist/server_pages/register.js +41 -0
- package/dist/server_pages/register_client_wrapper.d.ts +13 -0
- package/dist/server_pages/register_client_wrapper.d.ts.map +1 -0
- package/dist/server_pages/register_client_wrapper.js +27 -0
- package/dist/server_pages/reset_password.d.ts +44 -0
- package/dist/server_pages/reset_password.d.ts.map +1 -0
- package/dist/server_pages/reset_password.js +40 -0
- package/dist/server_pages/reset_password_client_wrapper.d.ts +13 -0
- package/dist/server_pages/reset_password_client_wrapper.d.ts.map +1 -0
- package/dist/server_pages/reset_password_client_wrapper.js +27 -0
- package/dist/server_pages/verify_email.d.ts +53 -0
- package/dist/server_pages/verify_email.d.ts.map +1 -0
- package/dist/server_pages/verify_email.js +40 -0
- package/dist/server_pages/verify_email_client_wrapper.d.ts +15 -0
- package/dist/server_pages/verify_email_client_wrapper.d.ts.map +1 -0
- package/dist/server_pages/verify_email_client_wrapper.js +27 -0
- package/package.json +39 -10
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
// file_description: server-only helper to read shared password requirements configuration from hazo_auth_config.ini
|
|
2
2
|
// section: imports
|
|
3
3
|
import { get_config_number, get_config_boolean } from "./config/config_loader.server";
|
|
4
|
+
import { DEFAULT_PASSWORD_REQUIREMENTS } from "./config/default_config";
|
|
4
5
|
// section: helpers
|
|
5
6
|
/**
|
|
6
7
|
* Reads shared password requirements configuration from hazo_auth_config.ini file
|
|
7
|
-
* Falls back to defaults if hazo_auth_config.ini is not found or section is missing
|
|
8
|
+
* Falls back to centralized defaults if hazo_auth_config.ini is not found or section is missing
|
|
8
9
|
* This configuration is used by both register and reset password layouts
|
|
9
10
|
* @returns Password requirements configuration options
|
|
10
11
|
*/
|
|
11
12
|
export function get_password_requirements_config() {
|
|
12
13
|
const section = "hazo_auth__password_requirements";
|
|
13
|
-
// Read password requirements with defaults
|
|
14
|
-
const minimum_length = get_config_number(section, "minimum_length",
|
|
15
|
-
const require_uppercase = get_config_boolean(section, "require_uppercase",
|
|
16
|
-
const require_lowercase = get_config_boolean(section, "require_lowercase",
|
|
17
|
-
const require_number = get_config_boolean(section, "require_number",
|
|
18
|
-
const require_special = get_config_boolean(section, "require_special",
|
|
14
|
+
// Read password requirements with centralized defaults
|
|
15
|
+
const minimum_length = get_config_number(section, "minimum_length", DEFAULT_PASSWORD_REQUIREMENTS.minimum_length);
|
|
16
|
+
const require_uppercase = get_config_boolean(section, "require_uppercase", DEFAULT_PASSWORD_REQUIREMENTS.require_uppercase);
|
|
17
|
+
const require_lowercase = get_config_boolean(section, "require_lowercase", DEFAULT_PASSWORD_REQUIREMENTS.require_lowercase);
|
|
18
|
+
const require_number = get_config_boolean(section, "require_number", DEFAULT_PASSWORD_REQUIREMENTS.require_number);
|
|
19
|
+
const require_special = get_config_boolean(section, "require_special", DEFAULT_PASSWORD_REQUIREMENTS.require_special);
|
|
19
20
|
return {
|
|
20
21
|
minimum_length,
|
|
21
22
|
require_uppercase,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { StaticImageData } from "next/image";
|
|
1
2
|
export type RegisterConfig = {
|
|
2
3
|
showNameField: boolean;
|
|
3
4
|
passwordRequirements: {
|
|
@@ -14,6 +15,9 @@ export type RegisterConfig = {
|
|
|
14
15
|
returnHomePath: string;
|
|
15
16
|
signInPath: string;
|
|
16
17
|
signInLabel: string;
|
|
18
|
+
imageSrc: string | StaticImageData;
|
|
19
|
+
imageAlt: string;
|
|
20
|
+
imageBackgroundColor: string;
|
|
17
21
|
};
|
|
18
22
|
/**
|
|
19
23
|
* Reads register layout configuration from hazo_auth_config.ini file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/register_config.server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"register_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/register_config.server.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,MAAM,cAAc,GAAG;IAC3B,aAAa,EAAE,OAAO,CAAC;IACvB,oBAAoB,EAAE;QACpB,cAAc,EAAE,MAAM,CAAC;QACvB,iBAAiB,EAAE,OAAO,CAAC;QAC3B,iBAAiB,EAAE,OAAO,CAAC;QAC3B,cAAc,EAAE,OAAO,CAAC;QACxB,eAAe,EAAE,OAAO,CAAC;KAC1B,CAAC;IACF,sBAAsB,EAAE,MAAM,CAAC;IAC/B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,GAAG,eAAe,CAAC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC;AAGF;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,cAAc,CA6DpD"}
|
|
@@ -4,6 +4,7 @@ import { get_config_boolean, get_config_value, read_config_section } from "./con
|
|
|
4
4
|
import { get_password_requirements_config } from "./password_requirements_config.server";
|
|
5
5
|
import { get_already_logged_in_config } from "./already_logged_in_config.server";
|
|
6
6
|
import { get_user_fields_config } from "./user_fields_config.server";
|
|
7
|
+
import registerDefaultImage from "../assets/images/register_default.jpg";
|
|
7
8
|
// section: helpers
|
|
8
9
|
/**
|
|
9
10
|
* Reads register layout configuration from hazo_auth_config.ini file
|
|
@@ -25,6 +26,12 @@ export function get_register_config() {
|
|
|
25
26
|
// Read sign in link configuration
|
|
26
27
|
const signInPath = get_config_value("hazo_auth__register_layout", "sign_in_path", "/hazo_auth/login");
|
|
27
28
|
const signInLabel = get_config_value("hazo_auth__register_layout", "sign_in_label", "Sign in");
|
|
29
|
+
// Read image configuration
|
|
30
|
+
// If not set in config, falls back to default image from assets
|
|
31
|
+
const imageSrc = get_config_value("hazo_auth__register_layout", "image_src", "" // Empty string means not set in config
|
|
32
|
+
) || registerDefaultImage;
|
|
33
|
+
const imageAlt = get_config_value("hazo_auth__register_layout", "image_alt", "Modern building representing user registration");
|
|
34
|
+
const imageBackgroundColor = get_config_value("hazo_auth__register_layout", "image_background_color", "#e2e8f0");
|
|
28
35
|
return {
|
|
29
36
|
showNameField,
|
|
30
37
|
passwordRequirements,
|
|
@@ -35,5 +42,8 @@ export function get_register_config() {
|
|
|
35
42
|
returnHomePath: alreadyLoggedInConfig.returnHomePath,
|
|
36
43
|
signInPath,
|
|
37
44
|
signInLabel,
|
|
45
|
+
imageSrc,
|
|
46
|
+
imageAlt,
|
|
47
|
+
imageBackgroundColor,
|
|
38
48
|
};
|
|
39
49
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { StaticImageData } from "next/image";
|
|
1
2
|
export type ResetPasswordConfig = {
|
|
2
3
|
errorMessage: string;
|
|
3
4
|
successMessage: string;
|
|
@@ -15,6 +16,9 @@ export type ResetPasswordConfig = {
|
|
|
15
16
|
require_number: boolean;
|
|
16
17
|
require_special: boolean;
|
|
17
18
|
};
|
|
19
|
+
imageSrc: string | StaticImageData;
|
|
20
|
+
imageAlt: string;
|
|
21
|
+
imageBackgroundColor: string;
|
|
18
22
|
};
|
|
19
23
|
/**
|
|
20
24
|
* Reads reset password layout configuration from hazo_auth_config.ini file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reset_password_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/reset_password_config.server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reset_password_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/reset_password_config.server.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,MAAM,mBAAmB,GAAG;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,cAAc,EAAE,MAAM,CAAC;IACvB,oBAAoB,EAAE;QACpB,cAAc,EAAE,MAAM,CAAC;QACvB,iBAAiB,EAAE,OAAO,CAAC;QAC3B,iBAAiB,EAAE,OAAO,CAAC;QAC3B,cAAc,EAAE,OAAO,CAAC;QACxB,eAAe,EAAE,OAAO,CAAC;KAC1B,CAAC;IACF,QAAQ,EAAE,MAAM,GAAG,eAAe,CAAC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC;AAGF;;;;GAIG;AACH,wBAAgB,yBAAyB,IAAI,mBAAmB,CA+D/D"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { get_config_value } from "./config/config_loader.server";
|
|
4
4
|
import { get_already_logged_in_config } from "./already_logged_in_config.server";
|
|
5
5
|
import { get_password_requirements_config } from "./password_requirements_config.server";
|
|
6
|
+
import resetPasswordDefaultImage from "../assets/images/reset_password_default.jpg";
|
|
6
7
|
// section: helpers
|
|
7
8
|
/**
|
|
8
9
|
* Reads reset password layout configuration from hazo_auth_config.ini file
|
|
@@ -23,6 +24,12 @@ export function get_reset_password_config() {
|
|
|
23
24
|
const forgotPasswordPath = get_config_value(section, "forgot_password_path", "/hazo_auth/forgot_password");
|
|
24
25
|
// Get shared password requirements
|
|
25
26
|
const passwordRequirements = get_password_requirements_config();
|
|
27
|
+
// Read image configuration
|
|
28
|
+
// If not set in config, falls back to default image from assets
|
|
29
|
+
const imageSrc = get_config_value(section, "image_src", "" // Empty string means not set in config
|
|
30
|
+
) || resetPasswordDefaultImage;
|
|
31
|
+
const imageAlt = get_config_value(section, "image_alt", "Reset password illustration");
|
|
32
|
+
const imageBackgroundColor = get_config_value(section, "image_background_color", "#f1f5f9");
|
|
26
33
|
return {
|
|
27
34
|
errorMessage,
|
|
28
35
|
successMessage,
|
|
@@ -34,5 +41,8 @@ export function get_reset_password_config() {
|
|
|
34
41
|
returnHomeButtonLabel: alreadyLoggedInConfig.returnHomeButtonLabel,
|
|
35
42
|
returnHomePath: alreadyLoggedInConfig.returnHomePath,
|
|
36
43
|
passwordRequirements,
|
|
44
|
+
imageSrc,
|
|
45
|
+
imageAlt,
|
|
46
|
+
imageBackgroundColor,
|
|
37
47
|
};
|
|
38
48
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type SessionTokenPayload = {
|
|
2
|
+
user_id: string;
|
|
3
|
+
email: string;
|
|
4
|
+
iat: number;
|
|
5
|
+
exp: number;
|
|
6
|
+
};
|
|
7
|
+
export type ValidateSessionTokenResult = {
|
|
8
|
+
valid: boolean;
|
|
9
|
+
user_id?: string;
|
|
10
|
+
email?: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Creates a JWT session token for a user
|
|
14
|
+
* Token includes user_id, email, issued at time, and expiration
|
|
15
|
+
* @param user_id - User ID
|
|
16
|
+
* @param email - User email address
|
|
17
|
+
* @returns JWT token string
|
|
18
|
+
*/
|
|
19
|
+
export declare function create_session_token(user_id: string, email: string): Promise<string>;
|
|
20
|
+
/**
|
|
21
|
+
* Validates a JWT session token
|
|
22
|
+
* Checks signature and expiration
|
|
23
|
+
* @param token - JWT token string
|
|
24
|
+
* @returns Validation result with user_id and email if valid
|
|
25
|
+
*/
|
|
26
|
+
export declare function validate_session_token(token: string): Promise<ValidateSessionTokenResult>;
|
|
27
|
+
//# sourceMappingURL=session_token_service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session_token_service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/session_token_service.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAuCF;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,MAAM,CAAC,CA0CjB;AAED;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,0BAA0B,CAAC,CAgDrC"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
// file_description: service for creating and validating JWT session tokens for authentication
|
|
2
|
+
// Uses jose library for Edge-compatible JWT operations
|
|
3
|
+
// section: imports
|
|
4
|
+
import { SignJWT, jwtVerify } from "jose";
|
|
5
|
+
import { create_app_logger } from "../app_logger";
|
|
6
|
+
import { get_filename, get_line_number } from "../utils/api_route_helpers";
|
|
7
|
+
// section: helpers
|
|
8
|
+
/**
|
|
9
|
+
* Gets JWT secret from environment variables
|
|
10
|
+
* @returns JWT secret as Uint8Array for jose library
|
|
11
|
+
* @throws Error if JWT_SECRET is not set
|
|
12
|
+
*/
|
|
13
|
+
function get_jwt_secret() {
|
|
14
|
+
const jwt_secret = process.env.JWT_SECRET;
|
|
15
|
+
if (!jwt_secret) {
|
|
16
|
+
const logger = create_app_logger();
|
|
17
|
+
logger.error("session_token_jwt_secret_missing", {
|
|
18
|
+
filename: get_filename(),
|
|
19
|
+
line_number: get_line_number(),
|
|
20
|
+
error: "JWT_SECRET environment variable is required",
|
|
21
|
+
});
|
|
22
|
+
throw new Error("JWT_SECRET environment variable is required");
|
|
23
|
+
}
|
|
24
|
+
// Convert string secret to Uint8Array for jose
|
|
25
|
+
return new TextEncoder().encode(jwt_secret);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Gets session token expiry in seconds (default: 30 days)
|
|
29
|
+
* @returns Number of seconds until token expires
|
|
30
|
+
*/
|
|
31
|
+
function get_session_token_expiry_seconds() {
|
|
32
|
+
// Default: 30 days = 30 * 24 * 60 * 60 = 2,592,000 seconds
|
|
33
|
+
const default_expiry_seconds = 60 * 60 * 24 * 30;
|
|
34
|
+
// Could be extended to read from config in the future
|
|
35
|
+
// For now, use default 30 days to match cookie expiry
|
|
36
|
+
return default_expiry_seconds;
|
|
37
|
+
}
|
|
38
|
+
// section: main_functions
|
|
39
|
+
/**
|
|
40
|
+
* Creates a JWT session token for a user
|
|
41
|
+
* Token includes user_id, email, issued at time, and expiration
|
|
42
|
+
* @param user_id - User ID
|
|
43
|
+
* @param email - User email address
|
|
44
|
+
* @returns JWT token string
|
|
45
|
+
*/
|
|
46
|
+
export async function create_session_token(user_id, email) {
|
|
47
|
+
const logger = create_app_logger();
|
|
48
|
+
try {
|
|
49
|
+
const secret = get_jwt_secret();
|
|
50
|
+
const now = Math.floor(Date.now() / 1000); // Current time in seconds
|
|
51
|
+
const expiry_seconds = get_session_token_expiry_seconds();
|
|
52
|
+
const exp = now + expiry_seconds;
|
|
53
|
+
const jwt = await new SignJWT({
|
|
54
|
+
user_id,
|
|
55
|
+
email,
|
|
56
|
+
})
|
|
57
|
+
.setProtectedHeader({ alg: "HS256" })
|
|
58
|
+
.setIssuedAt(now)
|
|
59
|
+
.setExpirationTime(exp)
|
|
60
|
+
.sign(secret);
|
|
61
|
+
logger.info("session_token_created", {
|
|
62
|
+
filename: get_filename(),
|
|
63
|
+
line_number: get_line_number(),
|
|
64
|
+
user_id,
|
|
65
|
+
email,
|
|
66
|
+
expires_in_seconds: expiry_seconds,
|
|
67
|
+
});
|
|
68
|
+
return jwt;
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
const error_message = error instanceof Error ? error.message : "Unknown error";
|
|
72
|
+
const error_stack = error instanceof Error ? error.stack : undefined;
|
|
73
|
+
logger.error("session_token_creation_failed", {
|
|
74
|
+
filename: get_filename(),
|
|
75
|
+
line_number: get_line_number(),
|
|
76
|
+
user_id,
|
|
77
|
+
email,
|
|
78
|
+
error_message,
|
|
79
|
+
error_stack,
|
|
80
|
+
});
|
|
81
|
+
throw new Error("Failed to create session token");
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Validates a JWT session token
|
|
86
|
+
* Checks signature and expiration
|
|
87
|
+
* @param token - JWT token string
|
|
88
|
+
* @returns Validation result with user_id and email if valid
|
|
89
|
+
*/
|
|
90
|
+
export async function validate_session_token(token) {
|
|
91
|
+
const logger = create_app_logger();
|
|
92
|
+
try {
|
|
93
|
+
const secret = get_jwt_secret();
|
|
94
|
+
const { payload } = await jwtVerify(token, secret, {
|
|
95
|
+
algorithms: ["HS256"],
|
|
96
|
+
});
|
|
97
|
+
// Extract user_id and email from payload
|
|
98
|
+
const user_id = payload.user_id;
|
|
99
|
+
const email = payload.email;
|
|
100
|
+
if (!user_id || !email) {
|
|
101
|
+
logger.warn("session_token_invalid_payload", {
|
|
102
|
+
filename: get_filename(),
|
|
103
|
+
line_number: get_line_number(),
|
|
104
|
+
error: "Token payload missing user_id or email",
|
|
105
|
+
});
|
|
106
|
+
return { valid: false };
|
|
107
|
+
}
|
|
108
|
+
logger.info("session_token_validated", {
|
|
109
|
+
filename: get_filename(),
|
|
110
|
+
line_number: get_line_number(),
|
|
111
|
+
user_id,
|
|
112
|
+
email,
|
|
113
|
+
});
|
|
114
|
+
return {
|
|
115
|
+
valid: true,
|
|
116
|
+
user_id,
|
|
117
|
+
email,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
const error_message = error instanceof Error ? error.message : "Unknown error";
|
|
122
|
+
// jose throws JWTExpired, JWTInvalid, etc. - these are expected for invalid tokens
|
|
123
|
+
logger.debug("session_token_validation_failed", {
|
|
124
|
+
filename: get_filename(),
|
|
125
|
+
line_number: get_line_number(),
|
|
126
|
+
error_message,
|
|
127
|
+
});
|
|
128
|
+
return { valid: false };
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forgot_password.d.ts","sourceRoot":"","sources":["../../src/page_components/forgot_password.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"forgot_password.d.ts","sourceRoot":"","sources":["../../src/page_components/forgot_password.tsx"],"names":[],"mappings":"AA+BA,MAAM,MAAM,uBAAuB,GAAG;IACpC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAGF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,sBAAoD,EACpD,gBAAuB,EACvB,oBAA4B,EAC5B,qBAAqC,EACrC,cAAoB,EACpB,QAA4B,EAC5B,QAA4B,EAC5B,oBAAuC,GACxC,GAAE,uBAA4B,2CAmC9B;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
// file_description: zero-config forgot password page component for hazo_auth
|
|
2
2
|
// Consumers can use this directly without needing to configure props
|
|
3
|
+
//
|
|
4
|
+
// ⚠️ DEPRECATED: This client component is deprecated in hazo_auth v2.0+
|
|
5
|
+
// Please use the new server component version instead:
|
|
6
|
+
//
|
|
7
|
+
// import { ForgotPasswordPage } from "hazo_auth/pages/forgot_password";
|
|
8
|
+
//
|
|
9
|
+
// The new version:
|
|
10
|
+
// - Initializes on the server (no loading state)
|
|
11
|
+
// - Works with your app's hazo_connect instance
|
|
12
|
+
// - True zero-config "drop in and use"
|
|
13
|
+
// - Better performance (smaller bundle)
|
|
14
|
+
//
|
|
15
|
+
// This file will be removed in v3.0
|
|
16
|
+
//
|
|
3
17
|
"use client";
|
|
4
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
19
|
// section: imports
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/page_components/login.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/page_components/login.tsx"],"names":[],"mappings":"AAgCA;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAGF;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,EACxB,aAAa,EACb,cAAyC,EACzC,sBAAoD,EACpD,gBAAuB,EACvB,oBAA4B,EAC5B,qBAAqC,EACrC,cAAoB,EACpB,kBAAiD,EACjD,mBAAwC,EACxC,iBAAyC,EACzC,kBAAqC,EACrC,UAAU,EACV,QAA4B,EAC5B,QAA4B,EAC5B,oBAAuC,GACxC,GAAE,cAAmB,2CA8CrB;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
// file_description: zero-config login page component for hazo_auth
|
|
2
2
|
// Consumers can use this directly without needing to configure props
|
|
3
|
+
//
|
|
4
|
+
// ⚠️ DEPRECATED: This client component is deprecated in hazo_auth v2.0+
|
|
5
|
+
// Please use the new server component version instead:
|
|
6
|
+
//
|
|
7
|
+
// import { LoginPage } from "hazo_auth/pages/login";
|
|
8
|
+
//
|
|
9
|
+
// The new version:
|
|
10
|
+
// - Initializes on the server (no loading state)
|
|
11
|
+
// - Works with your app's hazo_connect instance
|
|
12
|
+
// - True zero-config "drop in and use"
|
|
13
|
+
// - Better performance (smaller bundle)
|
|
14
|
+
//
|
|
15
|
+
// This file will be removed in v3.0
|
|
16
|
+
//
|
|
3
17
|
"use client";
|
|
4
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
19
|
// section: imports
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/page_components/register.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/page_components/register.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,0DAA0D,CAAC;AAgB7G,MAAM,MAAM,iBAAiB,GAAG;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,oBAAoB,CAAC,EAAE,4BAA4B,CAAC;IACpD,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAGF;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,EAC3B,aAAoB,EACpB,oBAAoD,EACpD,sBAAoD,EACpD,gBAAuB,EACvB,oBAA4B,EAC5B,qBAAqC,EACrC,cAAoB,EACpB,UAA+B,EAC/B,WAAuB,EACvB,UAAU,EACV,QAA4B,EAC5B,QAA4B,EAC5B,oBAAuC,GACxC,GAAE,iBAAsB,2CAwCxB;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
// file_description: zero-config register page component for hazo_auth
|
|
2
2
|
// Consumers can use this directly without needing to configure props
|
|
3
|
+
//
|
|
4
|
+
// ⚠️ DEPRECATED: This client component is deprecated in hazo_auth v2.0+
|
|
5
|
+
// Please use the new server component version instead:
|
|
6
|
+
//
|
|
7
|
+
// import { RegisterPage } from "hazo_auth/pages/register";
|
|
8
|
+
//
|
|
9
|
+
// The new version:
|
|
10
|
+
// - Initializes on the server (no loading state)
|
|
11
|
+
// - Works with your app's hazo_connect instance
|
|
12
|
+
// - True zero-config "drop in and use"
|
|
13
|
+
// - Better performance (smaller bundle)
|
|
14
|
+
//
|
|
15
|
+
// This file will be removed in v3.0
|
|
16
|
+
//
|
|
3
17
|
"use client";
|
|
4
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
19
|
// section: imports
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reset_password.d.ts","sourceRoot":"","sources":["../../src/page_components/reset_password.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reset_password.d.ts","sourceRoot":"","sources":["../../src/page_components/reset_password.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,0DAA0D,CAAC;AAgB7G,MAAM,MAAM,sBAAsB,GAAG;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oBAAoB,CAAC,EAAE,4BAA4B,CAAC;IACpD,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAGF;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,YAAmE,EACnE,cAAwF,EACxF,SAA8B,EAC9B,kBAAiD,EACjD,oBAAoD,EACpD,sBAAoD,EACpD,gBAAuB,EACvB,oBAA4B,EAC5B,qBAAqC,EACrC,cAAoB,EACpB,QAA4B,EAC5B,QAA4B,EAC5B,oBAAuC,GACxC,GAAE,sBAA2B,2CAsC7B;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
// file_description: zero-config reset password page component for hazo_auth
|
|
2
2
|
// Consumers can use this directly without needing to configure props
|
|
3
|
+
//
|
|
4
|
+
// ⚠️ DEPRECATED: This client component is deprecated in hazo_auth v2.0+
|
|
5
|
+
// Please use the new server component version instead:
|
|
6
|
+
//
|
|
7
|
+
// import { ResetPasswordPage } from "hazo_auth/pages/reset_password";
|
|
8
|
+
//
|
|
9
|
+
// The new version:
|
|
10
|
+
// - Initializes on the server (no loading state)
|
|
11
|
+
// - Works with your app's hazo_connect instance
|
|
12
|
+
// - True zero-config "drop in and use"
|
|
13
|
+
// - Better performance (smaller bundle)
|
|
14
|
+
//
|
|
15
|
+
// This file will be removed in v3.0
|
|
16
|
+
//
|
|
3
17
|
"use client";
|
|
4
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
19
|
// section: imports
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify_email.d.ts","sourceRoot":"","sources":["../../src/page_components/verify_email.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"verify_email.d.ts","sourceRoot":"","sources":["../../src/page_components/verify_email.tsx"],"names":[],"mappings":"AA+BA,MAAM,MAAM,oBAAoB,GAAG;IACjC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAGF;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,EAC9B,sBAAoD,EACpD,gBAAuB,EACvB,oBAA4B,EAC5B,qBAAqC,EACrC,cAAoB,EACpB,aAAoB,EACpB,SAA8B,EAC9B,QAA4B,EAC5B,QAA4B,EAC5B,oBAAuC,GACxC,GAAE,oBAAyB,2CAqC3B;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
// file_description: zero-config verify email page component for hazo_auth
|
|
2
2
|
// Consumers can use this directly without needing to configure props
|
|
3
|
+
//
|
|
4
|
+
// ⚠️ DEPRECATED: This client component is deprecated in hazo_auth v2.0+
|
|
5
|
+
// Please use the new server component version instead:
|
|
6
|
+
//
|
|
7
|
+
// import { VerifyEmailPage } from "hazo_auth/pages/verify_email";
|
|
8
|
+
//
|
|
9
|
+
// The new version:
|
|
10
|
+
// - Initializes on the server (no loading state)
|
|
11
|
+
// - Works with your app's hazo_connect instance
|
|
12
|
+
// - True zero-config "drop in and use"
|
|
13
|
+
// - Better performance (smaller bundle)
|
|
14
|
+
//
|
|
15
|
+
// This file will be removed in v3.0
|
|
16
|
+
//
|
|
3
17
|
"use client";
|
|
4
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
19
|
// section: imports
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export type ForgotPasswordPageProps = {
|
|
2
|
+
/**
|
|
3
|
+
* Optional image source for the visual panel
|
|
4
|
+
* @default "/globe.svg" (from default_config.ts)
|
|
5
|
+
*/
|
|
6
|
+
image_src?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Optional image alt text
|
|
9
|
+
* @default "Password recovery illustration"
|
|
10
|
+
*/
|
|
11
|
+
image_alt?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Optional image background color
|
|
14
|
+
* @default "#f1f5f9"
|
|
15
|
+
*/
|
|
16
|
+
image_background_color?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Optional path to sign in page
|
|
19
|
+
* @default "/hazo_auth/login" (from default_config.ts)
|
|
20
|
+
*/
|
|
21
|
+
sign_in_path?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Optional sign in link label
|
|
24
|
+
* @default "Back to login" (from default_config.ts)
|
|
25
|
+
*/
|
|
26
|
+
sign_in_label?: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Zero-config ForgotPasswordPage server component
|
|
30
|
+
*
|
|
31
|
+
* This component initializes everything server-side:
|
|
32
|
+
* - Database connection via hazo_connect singleton
|
|
33
|
+
* - Configuration from hazo_auth_config.ini (with sensible defaults)
|
|
34
|
+
* - Layout data client
|
|
35
|
+
*
|
|
36
|
+
* Usage in consuming apps:
|
|
37
|
+
* ```tsx
|
|
38
|
+
* // app/forgot-password/page.tsx
|
|
39
|
+
* import { ForgotPasswordPage } from "hazo_auth/pages/forgot_password";
|
|
40
|
+
*
|
|
41
|
+
* export default function Page() {
|
|
42
|
+
* return <ForgotPasswordPage />;
|
|
43
|
+
* }
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* Zero configuration required - works out of the box!
|
|
47
|
+
*
|
|
48
|
+
* @param props - Optional visual and navigation customization props
|
|
49
|
+
* @returns Server-rendered forgot password page
|
|
50
|
+
*/
|
|
51
|
+
export default function ForgotPasswordPage({ image_src, image_alt, image_background_color, sign_in_path, sign_in_label, }: ForgotPasswordPageProps): import("react/jsx-runtime").JSX.Element;
|
|
52
|
+
//# sourceMappingURL=forgot_password.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forgot_password.d.ts","sourceRoot":"","sources":["../../src/pages/forgot_password.tsx"],"names":[],"mappings":"AASA,MAAM,MAAM,uBAAuB,GAAG;IACpC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;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,EACzC,SAAsC,EACtC,SAA4C,EAC5C,sBAAkC,EAClC,YAAgD,EAChD,aAAkD,GACnD,EAAE,uBAAuB,2CAwBzB"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// file_description: Zero-config ForgotPasswordPage server component - drop in and use with no configuration required
|
|
3
|
+
// section: imports
|
|
4
|
+
import { get_hazo_connect_instance } from "../lib/hazo_connect_instance.server";
|
|
5
|
+
import { createLayoutDataClient } from "../components/layouts/shared/data/layout_data_client";
|
|
6
|
+
import { get_forgot_password_config } from "../lib/forgot_password_config.server";
|
|
7
|
+
import ForgotPasswordLayout from "../components/layouts/forgot_password";
|
|
8
|
+
import { DEFAULT_UI_SHELL, DEFAULT_FORGOT_PASSWORD } from "../lib/config/default_config";
|
|
9
|
+
// section: component
|
|
10
|
+
/**
|
|
11
|
+
* Zero-config ForgotPasswordPage server component
|
|
12
|
+
*
|
|
13
|
+
* This component initializes everything server-side:
|
|
14
|
+
* - Database connection via hazo_connect singleton
|
|
15
|
+
* - Configuration from hazo_auth_config.ini (with sensible defaults)
|
|
16
|
+
* - Layout data client
|
|
17
|
+
*
|
|
18
|
+
* Usage in consuming apps:
|
|
19
|
+
* ```tsx
|
|
20
|
+
* // app/forgot-password/page.tsx
|
|
21
|
+
* import { ForgotPasswordPage } from "hazo_auth/pages/forgot_password";
|
|
22
|
+
*
|
|
23
|
+
* export default function Page() {
|
|
24
|
+
* return <ForgotPasswordPage />;
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* Zero configuration required - works out of the box!
|
|
29
|
+
*
|
|
30
|
+
* @param props - Optional visual and navigation customization props
|
|
31
|
+
* @returns Server-rendered forgot password page
|
|
32
|
+
*/
|
|
33
|
+
export default function ForgotPasswordPage({ image_src = DEFAULT_UI_SHELL.image_src, image_alt = "Password recovery illustration", image_background_color = "#f1f5f9", sign_in_path = DEFAULT_FORGOT_PASSWORD.loginPath, sign_in_label = DEFAULT_FORGOT_PASSWORD.loginLabel, }) {
|
|
34
|
+
// Initialize database connection server-side
|
|
35
|
+
const hazoConnect = get_hazo_connect_instance();
|
|
36
|
+
const dataClient = createLayoutDataClient(hazoConnect);
|
|
37
|
+
// Load configuration from INI file (with defaults)
|
|
38
|
+
const config = get_forgot_password_config();
|
|
39
|
+
// Render layout with all server-initialized dependencies
|
|
40
|
+
return (_jsx(ForgotPasswordLayout, { image_src: image_src, image_alt: image_alt, image_background_color: image_background_color, data_client: dataClient, sign_in_path: sign_in_path, sign_in_label: sign_in_label, alreadyLoggedInMessage: config.alreadyLoggedInMessage, showLogoutButton: config.showLogoutButton, showReturnHomeButton: config.showReturnHomeButton, returnHomeButtonLabel: config.returnHomeButtonLabel, returnHomePath: config.returnHomePath }));
|
|
41
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zero-config page components for hazo_auth v2.0+
|
|
3
|
+
*
|
|
4
|
+
* These are server components that initialize everything on the server:
|
|
5
|
+
* - Database connection via hazo_connect singleton
|
|
6
|
+
* - Configuration from hazo_auth_config.ini (with sensible defaults)
|
|
7
|
+
* - All required dependencies and props
|
|
8
|
+
*
|
|
9
|
+
* Usage in consuming apps:
|
|
10
|
+
* ```tsx
|
|
11
|
+
* // app/login/page.tsx
|
|
12
|
+
* import { LoginPage } from "hazo_auth/pages";
|
|
13
|
+
*
|
|
14
|
+
* export default function Page() {
|
|
15
|
+
* return <LoginPage />;
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* All pages work out-of-the-box with ZERO configuration required!
|
|
20
|
+
*/
|
|
21
|
+
export { default as LoginPage } from "./login";
|
|
22
|
+
export { default as RegisterPage } from "./register";
|
|
23
|
+
export { default as VerifyEmailPage } from "./verify_email";
|
|
24
|
+
export { default as ForgotPasswordPage } from "./forgot_password";
|
|
25
|
+
export { default as ResetPasswordPage } from "./reset_password";
|
|
26
|
+
export { default as MySettingsPage } from "./my_settings";
|
|
27
|
+
export type { LoginPageProps } from "./login";
|
|
28
|
+
export type { RegisterPageProps } from "./register";
|
|
29
|
+
export type { VerifyEmailPageProps } from "./verify_email";
|
|
30
|
+
export type { ForgotPasswordPageProps } from "./forgot_password";
|
|
31
|
+
export type { ResetPasswordPageProps } from "./reset_password";
|
|
32
|
+
export type { MySettingsPageProps } from "./my_settings";
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pages/index.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,eAAe,CAAC;AAG1D,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,YAAY,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,YAAY,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AACjE,YAAY,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC/D,YAAY,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// file_description: Barrel export for all zero-config page components
|
|
2
|
+
// section: exports
|
|
3
|
+
/**
|
|
4
|
+
* Zero-config page components for hazo_auth v2.0+
|
|
5
|
+
*
|
|
6
|
+
* These are server components that initialize everything on the server:
|
|
7
|
+
* - Database connection via hazo_connect singleton
|
|
8
|
+
* - Configuration from hazo_auth_config.ini (with sensible defaults)
|
|
9
|
+
* - All required dependencies and props
|
|
10
|
+
*
|
|
11
|
+
* Usage in consuming apps:
|
|
12
|
+
* ```tsx
|
|
13
|
+
* // app/login/page.tsx
|
|
14
|
+
* import { LoginPage } from "hazo_auth/pages";
|
|
15
|
+
*
|
|
16
|
+
* export default function Page() {
|
|
17
|
+
* return <LoginPage />;
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* All pages work out-of-the-box with ZERO configuration required!
|
|
22
|
+
*/
|
|
23
|
+
export { default as LoginPage } from "./login";
|
|
24
|
+
export { default as RegisterPage } from "./register";
|
|
25
|
+
export { default as VerifyEmailPage } from "./verify_email";
|
|
26
|
+
export { default as ForgotPasswordPage } from "./forgot_password";
|
|
27
|
+
export { default as ResetPasswordPage } from "./reset_password";
|
|
28
|
+
export { default as MySettingsPage } from "./my_settings";
|