hazo_auth 1.6.7 → 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.
Files changed (151) hide show
  1. package/README.md +114 -14
  2. package/dist/components/layouts/email_verification/hooks/use_email_verification.d.ts.map +1 -1
  3. package/dist/components/layouts/email_verification/hooks/use_email_verification.js +5 -3
  4. package/dist/components/layouts/email_verification/index.d.ts +2 -1
  5. package/dist/components/layouts/email_verification/index.d.ts.map +1 -1
  6. package/dist/components/layouts/forgot_password/hooks/use_forgot_password_form.d.ts.map +1 -1
  7. package/dist/components/layouts/forgot_password/hooks/use_forgot_password_form.js +3 -1
  8. package/dist/components/layouts/forgot_password/index.d.ts +2 -1
  9. package/dist/components/layouts/forgot_password/index.d.ts.map +1 -1
  10. package/dist/components/layouts/login/hooks/use_login_form.d.ts.map +1 -1
  11. package/dist/components/layouts/login/hooks/use_login_form.js +3 -1
  12. package/dist/components/layouts/login/index.d.ts +2 -1
  13. package/dist/components/layouts/login/index.d.ts.map +1 -1
  14. package/dist/components/layouts/my_settings/components/profile_picture_dialog.d.ts.map +1 -1
  15. package/dist/components/layouts/my_settings/components/profile_picture_dialog.js +3 -1
  16. package/dist/components/layouts/my_settings/components/profile_picture_library_tab.d.ts.map +1 -1
  17. package/dist/components/layouts/my_settings/components/profile_picture_library_tab.js +4 -2
  18. package/dist/components/layouts/my_settings/hooks/use_my_settings.d.ts.map +1 -1
  19. package/dist/components/layouts/my_settings/hooks/use_my_settings.js +7 -5
  20. package/dist/components/layouts/my_settings/index.d.ts +2 -1
  21. package/dist/components/layouts/my_settings/index.d.ts.map +1 -1
  22. package/dist/components/layouts/my_settings/index.js +3 -2
  23. package/dist/components/layouts/register/hooks/use_register_form.d.ts.map +1 -1
  24. package/dist/components/layouts/register/hooks/use_register_form.js +3 -1
  25. package/dist/components/layouts/register/index.d.ts +2 -1
  26. package/dist/components/layouts/register/index.d.ts.map +1 -1
  27. package/dist/components/layouts/reset_password/hooks/use_reset_password_form.d.ts.map +1 -1
  28. package/dist/components/layouts/reset_password/hooks/use_reset_password_form.js +4 -2
  29. package/dist/components/layouts/reset_password/index.d.ts +2 -1
  30. package/dist/components/layouts/reset_password/index.d.ts.map +1 -1
  31. package/dist/components/layouts/shared/components/already_logged_in_guard.d.ts +2 -1
  32. package/dist/components/layouts/shared/components/already_logged_in_guard.d.ts.map +1 -1
  33. package/dist/components/layouts/shared/components/logout_button.d.ts.map +1 -1
  34. package/dist/components/layouts/shared/components/logout_button.js +3 -1
  35. package/dist/components/layouts/shared/components/profile_pic_menu.d.ts.map +1 -1
  36. package/dist/components/layouts/shared/components/profile_pic_menu.js +8 -4
  37. package/dist/components/layouts/shared/components/two_column_auth_layout.d.ts +2 -1
  38. package/dist/components/layouts/shared/components/two_column_auth_layout.d.ts.map +1 -1
  39. package/dist/components/layouts/shared/components/visual_panel.d.ts +2 -1
  40. package/dist/components/layouts/shared/components/visual_panel.d.ts.map +1 -1
  41. package/dist/components/layouts/shared/components/visual_panel.js +2 -1
  42. package/dist/components/layouts/shared/hooks/use_auth_status.d.ts.map +1 -1
  43. package/dist/components/layouts/shared/hooks/use_auth_status.js +4 -2
  44. package/dist/components/layouts/shared/hooks/use_hazo_auth.d.ts.map +1 -1
  45. package/dist/components/layouts/shared/hooks/use_hazo_auth.js +4 -2
  46. package/dist/components/layouts/shared/index.d.ts +0 -2
  47. package/dist/components/layouts/shared/index.d.ts.map +1 -1
  48. package/dist/components/layouts/shared/index.js +2 -2
  49. package/dist/components/layouts/user_management/components/roles_matrix.d.ts.map +1 -1
  50. package/dist/components/layouts/user_management/components/roles_matrix.js +8 -6
  51. package/dist/components/layouts/user_management/index.d.ts.map +1 -1
  52. package/dist/components/layouts/user_management/index.js +15 -13
  53. package/dist/contexts/hazo_auth_config.d.ts +18 -0
  54. package/dist/contexts/hazo_auth_config.d.ts.map +1 -0
  55. package/dist/contexts/hazo_auth_config.js +10 -0
  56. package/dist/contexts/hazo_auth_provider.d.ts +73 -0
  57. package/dist/contexts/hazo_auth_provider.d.ts.map +1 -0
  58. package/dist/contexts/hazo_auth_provider.js +82 -0
  59. package/dist/index.d.ts +2 -0
  60. package/dist/index.d.ts.map +1 -1
  61. package/dist/index.js +3 -0
  62. package/dist/lib/config/default_config.d.ts +237 -0
  63. package/dist/lib/config/default_config.d.ts.map +1 -0
  64. package/dist/lib/config/default_config.js +159 -0
  65. package/dist/lib/email_verification_config.server.d.ts +4 -0
  66. package/dist/lib/email_verification_config.server.d.ts.map +1 -1
  67. package/dist/lib/email_verification_config.server.js +12 -0
  68. package/dist/lib/forgot_password_config.server.d.ts +4 -0
  69. package/dist/lib/forgot_password_config.server.d.ts.map +1 -1
  70. package/dist/lib/forgot_password_config.server.js +12 -0
  71. package/dist/lib/login_config.server.d.ts +4 -0
  72. package/dist/lib/login_config.server.d.ts.map +1 -1
  73. package/dist/lib/login_config.server.js +10 -0
  74. package/dist/lib/password_requirements_config.server.d.ts +1 -1
  75. package/dist/lib/password_requirements_config.server.d.ts.map +1 -1
  76. package/dist/lib/password_requirements_config.server.js +8 -7
  77. package/dist/lib/register_config.server.d.ts +4 -0
  78. package/dist/lib/register_config.server.d.ts.map +1 -1
  79. package/dist/lib/register_config.server.js +10 -0
  80. package/dist/lib/reset_password_config.server.d.ts +4 -0
  81. package/dist/lib/reset_password_config.server.d.ts.map +1 -1
  82. package/dist/lib/reset_password_config.server.js +10 -0
  83. package/dist/page_components/forgot_password.d.ts.map +1 -1
  84. package/dist/page_components/forgot_password.js +14 -0
  85. package/dist/page_components/login.d.ts +4 -0
  86. package/dist/page_components/login.d.ts.map +1 -1
  87. package/dist/page_components/login.js +14 -0
  88. package/dist/page_components/register.d.ts.map +1 -1
  89. package/dist/page_components/register.js +14 -0
  90. package/dist/page_components/reset_password.d.ts.map +1 -1
  91. package/dist/page_components/reset_password.js +14 -0
  92. package/dist/page_components/verify_email.d.ts.map +1 -1
  93. package/dist/page_components/verify_email.js +14 -0
  94. package/dist/pages/forgot_password.d.ts +52 -0
  95. package/dist/pages/forgot_password.d.ts.map +1 -0
  96. package/dist/pages/forgot_password.js +41 -0
  97. package/dist/pages/index.d.ts +33 -0
  98. package/dist/pages/index.d.ts.map +1 -0
  99. package/dist/pages/index.js +28 -0
  100. package/dist/pages/login.d.ts +43 -0
  101. package/dist/pages/login.d.ts.map +1 -0
  102. package/dist/pages/login.js +45 -0
  103. package/dist/pages/my_settings.d.ts +54 -0
  104. package/dist/pages/my_settings.d.ts.map +1 -0
  105. package/dist/pages/my_settings.js +57 -0
  106. package/dist/pages/register.d.ts +44 -0
  107. package/dist/pages/register.d.ts.map +1 -0
  108. package/dist/pages/register.js +46 -0
  109. package/dist/pages/reset_password.d.ts +43 -0
  110. package/dist/pages/reset_password.d.ts.map +1 -0
  111. package/dist/pages/reset_password.js +42 -0
  112. package/dist/pages/verify_email.d.ts +52 -0
  113. package/dist/pages/verify_email.d.ts.map +1 -0
  114. package/dist/pages/verify_email.js +41 -0
  115. package/dist/server_pages/forgot_password.d.ts +53 -0
  116. package/dist/server_pages/forgot_password.d.ts.map +1 -0
  117. package/dist/server_pages/forgot_password.js +40 -0
  118. package/dist/server_pages/forgot_password_client_wrapper.d.ts +15 -0
  119. package/dist/server_pages/forgot_password_client_wrapper.d.ts.map +1 -0
  120. package/dist/server_pages/forgot_password_client_wrapper.js +27 -0
  121. package/dist/server_pages/index.d.ts +13 -0
  122. package/dist/server_pages/index.d.ts.map +1 -0
  123. package/dist/server_pages/index.js +7 -0
  124. package/dist/server_pages/login.d.ts +43 -0
  125. package/dist/server_pages/login.d.ts.map +1 -0
  126. package/dist/server_pages/login.js +39 -0
  127. package/dist/server_pages/login_client_wrapper.d.ts +13 -0
  128. package/dist/server_pages/login_client_wrapper.d.ts.map +1 -0
  129. package/dist/server_pages/login_client_wrapper.js +29 -0
  130. package/dist/server_pages/my_settings.d.ts +53 -0
  131. package/dist/server_pages/my_settings.d.ts.map +1 -0
  132. package/dist/server_pages/my_settings.js +57 -0
  133. package/dist/server_pages/register.d.ts +45 -0
  134. package/dist/server_pages/register.d.ts.map +1 -0
  135. package/dist/server_pages/register.js +41 -0
  136. package/dist/server_pages/register_client_wrapper.d.ts +13 -0
  137. package/dist/server_pages/register_client_wrapper.d.ts.map +1 -0
  138. package/dist/server_pages/register_client_wrapper.js +27 -0
  139. package/dist/server_pages/reset_password.d.ts +44 -0
  140. package/dist/server_pages/reset_password.d.ts.map +1 -0
  141. package/dist/server_pages/reset_password.js +40 -0
  142. package/dist/server_pages/reset_password_client_wrapper.d.ts +13 -0
  143. package/dist/server_pages/reset_password_client_wrapper.d.ts.map +1 -0
  144. package/dist/server_pages/reset_password_client_wrapper.js +27 -0
  145. package/dist/server_pages/verify_email.d.ts +53 -0
  146. package/dist/server_pages/verify_email.d.ts.map +1 -0
  147. package/dist/server_pages/verify_email.js +40 -0
  148. package/dist/server_pages/verify_email_client_wrapper.d.ts +15 -0
  149. package/dist/server_pages/verify_email_client_wrapper.d.ts.map +1 -0
  150. package/dist/server_pages/verify_email_client_wrapper.js +27 -0
  151. package/package.json +34 -10
@@ -0,0 +1,73 @@
1
+ import { type ReactNode } from "react";
2
+ import { type HazoAuthConfig } from "./hazo_auth_config";
3
+ /**
4
+ * Props for HazoAuthProvider component
5
+ */
6
+ export type HazoAuthProviderProps = {
7
+ /**
8
+ * Base path for all hazo_auth API endpoints
9
+ * @default "/api/hazo_auth"
10
+ * @example "/api/v1/auth" - Custom API path
11
+ */
12
+ apiBasePath?: string;
13
+ /**
14
+ * Child components that will have access to the configuration
15
+ */
16
+ children: ReactNode;
17
+ };
18
+ /**
19
+ * Context Provider for hazo_auth runtime configuration
20
+ *
21
+ * Wrap your app (or specific parts) with this provider to customize
22
+ * API paths and other runtime settings for all hazo_auth components.
23
+ *
24
+ * @example
25
+ * ```tsx
26
+ * // In your root layout or app component
27
+ * import { HazoAuthProvider } from "hazo_auth/provider";
28
+ *
29
+ * export default function RootLayout({ children }) {
30
+ * return (
31
+ * <html>
32
+ * <body>
33
+ * <HazoAuthProvider apiBasePath="/api/v1/auth">
34
+ * {children}
35
+ * </HazoAuthProvider>
36
+ * </body>
37
+ * </html>
38
+ * );
39
+ * }
40
+ * ```
41
+ *
42
+ * @example
43
+ * ```tsx
44
+ * // Using default values (no provider needed)
45
+ * // All components will use "/api/hazo_auth" as the base path
46
+ * export default function App() {
47
+ * return <LoginPage />;
48
+ * }
49
+ * ```
50
+ */
51
+ export declare function HazoAuthProvider({ apiBasePath, children }: HazoAuthProviderProps): import("react/jsx-runtime").JSX.Element;
52
+ /**
53
+ * Hook to access hazo_auth runtime configuration
54
+ *
55
+ * Returns the current configuration from the nearest HazoAuthProvider,
56
+ * or default values if no provider is present.
57
+ *
58
+ * @example
59
+ * ```tsx
60
+ * function MyComponent() {
61
+ * const { apiBasePath } = useHazoAuthConfig();
62
+ *
63
+ * const response = await fetch(`${apiBasePath}/login`, {
64
+ * method: "POST",
65
+ * body: JSON.stringify({ email, password }),
66
+ * });
67
+ * }
68
+ * ```
69
+ *
70
+ * @returns Current HazoAuthConfig
71
+ */
72
+ export declare function useHazoAuthConfig(): HazoAuthConfig;
73
+ //# sourceMappingURL=hazo_auth_provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hazo_auth_provider.d.ts","sourceRoot":"","sources":["../../src/contexts/hazo_auth_provider.tsx"],"names":[],"mappings":"AAMA,OAAc,EAAsC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAClF,OAAO,EAA4B,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAYnF;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAIF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,WAAkD,EAClD,QAAQ,EACT,EAAE,qBAAqB,2CAcvB;AAID;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,IAAI,cAAc,CAMlD"}
@@ -0,0 +1,82 @@
1
+ // file_description: React Context Provider for hazo_auth runtime configuration
2
+ // Provides global configuration for API paths and other runtime settings
3
+ // Must be used as a wrapper in consuming apps for customizing API endpoints
4
+ // section: imports
5
+ "use client";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ import { createContext, useContext, useMemo } from "react";
8
+ import { DEFAULT_HAZO_AUTH_CONFIG } from "./hazo_auth_config";
9
+ // section: context_definition
10
+ /**
11
+ * React Context for hazo_auth configuration
12
+ * @internal
13
+ */
14
+ const HazoAuthConfigContext = createContext(DEFAULT_HAZO_AUTH_CONFIG);
15
+ // section: provider_component
16
+ /**
17
+ * Context Provider for hazo_auth runtime configuration
18
+ *
19
+ * Wrap your app (or specific parts) with this provider to customize
20
+ * API paths and other runtime settings for all hazo_auth components.
21
+ *
22
+ * @example
23
+ * ```tsx
24
+ * // In your root layout or app component
25
+ * import { HazoAuthProvider } from "hazo_auth/provider";
26
+ *
27
+ * export default function RootLayout({ children }) {
28
+ * return (
29
+ * <html>
30
+ * <body>
31
+ * <HazoAuthProvider apiBasePath="/api/v1/auth">
32
+ * {children}
33
+ * </HazoAuthProvider>
34
+ * </body>
35
+ * </html>
36
+ * );
37
+ * }
38
+ * ```
39
+ *
40
+ * @example
41
+ * ```tsx
42
+ * // Using default values (no provider needed)
43
+ * // All components will use "/api/hazo_auth" as the base path
44
+ * export default function App() {
45
+ * return <LoginPage />;
46
+ * }
47
+ * ```
48
+ */
49
+ export function HazoAuthProvider({ apiBasePath = DEFAULT_HAZO_AUTH_CONFIG.apiBasePath, children }) {
50
+ // Memoize config to avoid unnecessary re-renders
51
+ const config = useMemo(() => ({
52
+ apiBasePath,
53
+ }), [apiBasePath]);
54
+ return (_jsx(HazoAuthConfigContext.Provider, { value: config, children: children }));
55
+ }
56
+ // section: hook
57
+ /**
58
+ * Hook to access hazo_auth runtime configuration
59
+ *
60
+ * Returns the current configuration from the nearest HazoAuthProvider,
61
+ * or default values if no provider is present.
62
+ *
63
+ * @example
64
+ * ```tsx
65
+ * function MyComponent() {
66
+ * const { apiBasePath } = useHazoAuthConfig();
67
+ *
68
+ * const response = await fetch(`${apiBasePath}/login`, {
69
+ * method: "POST",
70
+ * body: JSON.stringify({ email, password }),
71
+ * });
72
+ * }
73
+ * ```
74
+ *
75
+ * @returns Current HazoAuthConfig
76
+ */
77
+ export function useHazoAuthConfig() {
78
+ const context = useContext(HazoAuthConfigContext);
79
+ // Context will always have a value (either from provider or default)
80
+ // No need to check for undefined
81
+ return context;
82
+ }
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ export * from "./contexts/hazo_auth_provider";
2
+ export * from "./contexts/hazo_auth_config";
1
3
  export * from "./components/index";
2
4
  export * from "./lib/index";
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,oBAAoB,CAAC;AAGnC,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAG5C,cAAc,oBAAoB,CAAC;AAGnC,cAAc,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,7 @@
1
1
  // file_description: main entry point for hazo_auth package - exports all public APIs
2
+ // section: context_exports
3
+ export * from "./contexts/hazo_auth_provider";
4
+ export * from "./contexts/hazo_auth_config";
2
5
  // section: component_exports
3
6
  export * from "./components/index";
4
7
  // section: lib_exports
@@ -0,0 +1,237 @@
1
+ export declare const DEFAULT_PASSWORD_REQUIREMENTS: {
2
+ readonly minimum_length: 8;
3
+ readonly require_uppercase: false;
4
+ readonly require_lowercase: false;
5
+ readonly require_number: false;
6
+ readonly require_special: false;
7
+ };
8
+ export declare const DEFAULT_USER_FIELDS: {
9
+ readonly show_name_field: true;
10
+ readonly show_email_field: true;
11
+ readonly show_password_field: true;
12
+ };
13
+ export declare const DEFAULT_PROFILE_PICTURE: {
14
+ readonly allow_photo_upload: true;
15
+ readonly max_photo_size: 5242880;
16
+ readonly user_photo_default: true;
17
+ readonly user_photo_default_priority1: "gravatar";
18
+ readonly user_photo_default_priority2: "library";
19
+ readonly library_photo_path: "/profile_pictures/library";
20
+ };
21
+ export declare const DEFAULT_UI_SIZES: {
22
+ readonly gravatar_size: 200;
23
+ readonly profile_picture_size: 128;
24
+ readonly tooltip_icon_size_default: 16;
25
+ readonly tooltip_icon_size_small: 14;
26
+ readonly library_photo_grid_columns: 4;
27
+ readonly library_photo_preview_size: 80;
28
+ readonly image_compression_max_dimension: 800;
29
+ readonly upload_file_hard_limit_bytes: 10485760;
30
+ };
31
+ export declare const DEFAULT_FILE_TYPES: {
32
+ readonly allowed_image_extensions: readonly [".jpg", ".jpeg", ".png", ".gif", ".webp"];
33
+ readonly allowed_image_mime_types: readonly ["image/jpeg", "image/png", "image/gif", "image/webp"];
34
+ };
35
+ export declare const DEFAULT_MESSAGES: {
36
+ readonly photo_upload_disabled_message: "Photo upload is currently disabled. Contact your administrator.";
37
+ readonly gravatar_setup_message: "To use Gravatar, create a free account at gravatar.com with the same email address you use here.";
38
+ readonly gravatar_no_account_message: "No Gravatar account found for your email. Using library photo instead.";
39
+ readonly library_tooltip_message: "Choose from our library of profile pictures";
40
+ };
41
+ export declare const DEFAULT_ALREADY_LOGGED_IN: {
42
+ readonly message: "You are already logged in";
43
+ readonly showLogoutButton: true;
44
+ readonly showReturnHomeButton: true;
45
+ readonly returnHomeButtonLabel: "Return Home";
46
+ readonly returnHomePath: "/";
47
+ };
48
+ export declare const DEFAULT_LOGIN: {
49
+ readonly redirectRoute: string | undefined;
50
+ readonly successMessage: "Successfully logged in";
51
+ readonly forgotPasswordPath: "/hazo_auth/forgot_password";
52
+ readonly forgotPasswordLabel: "Forgot password?";
53
+ readonly createAccountPath: "/hazo_auth/register";
54
+ readonly createAccountLabel: "Create account";
55
+ };
56
+ export declare const DEFAULT_REGISTER: {
57
+ readonly redirectRoute: string | undefined;
58
+ readonly successMessage: "Registration successful! Please check your email to verify your account.";
59
+ readonly loginPath: "/hazo_auth/login";
60
+ readonly loginLabel: "Already have an account? Sign in";
61
+ readonly requireEmailVerification: true;
62
+ };
63
+ export declare const DEFAULT_FORGOT_PASSWORD: {
64
+ readonly successMessage: "If an account with that email exists, a password reset link has been sent.";
65
+ readonly loginPath: "/hazo_auth/login";
66
+ readonly loginLabel: "Back to login";
67
+ };
68
+ export declare const DEFAULT_RESET_PASSWORD: {
69
+ readonly successMessage: "Password reset successfully. You can now log in with your new password.";
70
+ readonly loginPath: "/hazo_auth/login";
71
+ readonly redirectDelay: 2;
72
+ };
73
+ export declare const DEFAULT_EMAIL_VERIFICATION: {
74
+ readonly successMessage: "Email verified successfully! Redirecting to login...";
75
+ readonly errorMessage: "Email verification failed. The link may have expired.";
76
+ readonly loginPath: "/hazo_auth/login";
77
+ readonly redirectDelay: 5;
78
+ };
79
+ export declare const DEFAULT_MY_SETTINGS: {
80
+ readonly showNameField: true;
81
+ readonly showEmailField: true;
82
+ readonly showPasswordField: true;
83
+ readonly showProfilePicture: true;
84
+ };
85
+ export declare const DEFAULT_USER_MANAGEMENT: {
86
+ readonly enableUserManagement: true;
87
+ readonly enableRoleManagement: true;
88
+ readonly enablePermissionManagement: true;
89
+ };
90
+ export declare const DEFAULT_AUTH_UTILITY: {
91
+ readonly sessionCookieName: "hazo_session";
92
+ readonly sessionDuration: 86400;
93
+ readonly requireEmailVerification: true;
94
+ };
95
+ export declare const DEFAULT_UI_SHELL: {
96
+ readonly layout_mode: "standalone" | "test_sidebar";
97
+ readonly image_src: "/globe.svg";
98
+ readonly image_width: 400;
99
+ readonly image_height: 400;
100
+ readonly show_visual_panel: true;
101
+ };
102
+ export declare const DEFAULT_PROFILE_PIC_MENU: {
103
+ readonly show_single_button: false;
104
+ readonly sign_up_label: "Sign Up";
105
+ readonly sign_in_label: "Sign In";
106
+ readonly register_path: "/hazo_auth/register";
107
+ readonly login_path: "/hazo_auth/login";
108
+ readonly settings_path: "/hazo_auth/my_settings";
109
+ readonly logout_path: "/api/hazo_auth/logout";
110
+ };
111
+ export declare const DEFAULT_API_PATHS: {
112
+ readonly apiBasePath: "/api/hazo_auth";
113
+ };
114
+ /**
115
+ * All default configuration values combined in one object
116
+ * This makes it easy to see all defaults at a glance and export them as needed
117
+ */
118
+ export declare const HAZO_AUTH_DEFAULTS: {
119
+ readonly passwordRequirements: {
120
+ readonly minimum_length: 8;
121
+ readonly require_uppercase: false;
122
+ readonly require_lowercase: false;
123
+ readonly require_number: false;
124
+ readonly require_special: false;
125
+ };
126
+ readonly userFields: {
127
+ readonly show_name_field: true;
128
+ readonly show_email_field: true;
129
+ readonly show_password_field: true;
130
+ };
131
+ readonly profilePicture: {
132
+ readonly allow_photo_upload: true;
133
+ readonly max_photo_size: 5242880;
134
+ readonly user_photo_default: true;
135
+ readonly user_photo_default_priority1: "gravatar";
136
+ readonly user_photo_default_priority2: "library";
137
+ readonly library_photo_path: "/profile_pictures/library";
138
+ };
139
+ readonly uiSizes: {
140
+ readonly gravatar_size: 200;
141
+ readonly profile_picture_size: 128;
142
+ readonly tooltip_icon_size_default: 16;
143
+ readonly tooltip_icon_size_small: 14;
144
+ readonly library_photo_grid_columns: 4;
145
+ readonly library_photo_preview_size: 80;
146
+ readonly image_compression_max_dimension: 800;
147
+ readonly upload_file_hard_limit_bytes: 10485760;
148
+ };
149
+ readonly fileTypes: {
150
+ readonly allowed_image_extensions: readonly [".jpg", ".jpeg", ".png", ".gif", ".webp"];
151
+ readonly allowed_image_mime_types: readonly ["image/jpeg", "image/png", "image/gif", "image/webp"];
152
+ };
153
+ readonly messages: {
154
+ readonly photo_upload_disabled_message: "Photo upload is currently disabled. Contact your administrator.";
155
+ readonly gravatar_setup_message: "To use Gravatar, create a free account at gravatar.com with the same email address you use here.";
156
+ readonly gravatar_no_account_message: "No Gravatar account found for your email. Using library photo instead.";
157
+ readonly library_tooltip_message: "Choose from our library of profile pictures";
158
+ };
159
+ readonly alreadyLoggedIn: {
160
+ readonly message: "You are already logged in";
161
+ readonly showLogoutButton: true;
162
+ readonly showReturnHomeButton: true;
163
+ readonly returnHomeButtonLabel: "Return Home";
164
+ readonly returnHomePath: "/";
165
+ };
166
+ readonly login: {
167
+ readonly redirectRoute: string | undefined;
168
+ readonly successMessage: "Successfully logged in";
169
+ readonly forgotPasswordPath: "/hazo_auth/forgot_password";
170
+ readonly forgotPasswordLabel: "Forgot password?";
171
+ readonly createAccountPath: "/hazo_auth/register";
172
+ readonly createAccountLabel: "Create account";
173
+ };
174
+ readonly register: {
175
+ readonly redirectRoute: string | undefined;
176
+ readonly successMessage: "Registration successful! Please check your email to verify your account.";
177
+ readonly loginPath: "/hazo_auth/login";
178
+ readonly loginLabel: "Already have an account? Sign in";
179
+ readonly requireEmailVerification: true;
180
+ };
181
+ readonly forgotPassword: {
182
+ readonly successMessage: "If an account with that email exists, a password reset link has been sent.";
183
+ readonly loginPath: "/hazo_auth/login";
184
+ readonly loginLabel: "Back to login";
185
+ };
186
+ readonly resetPassword: {
187
+ readonly successMessage: "Password reset successfully. You can now log in with your new password.";
188
+ readonly loginPath: "/hazo_auth/login";
189
+ readonly redirectDelay: 2;
190
+ };
191
+ readonly emailVerification: {
192
+ readonly successMessage: "Email verified successfully! Redirecting to login...";
193
+ readonly errorMessage: "Email verification failed. The link may have expired.";
194
+ readonly loginPath: "/hazo_auth/login";
195
+ readonly redirectDelay: 5;
196
+ };
197
+ readonly mySettings: {
198
+ readonly showNameField: true;
199
+ readonly showEmailField: true;
200
+ readonly showPasswordField: true;
201
+ readonly showProfilePicture: true;
202
+ };
203
+ readonly userManagement: {
204
+ readonly enableUserManagement: true;
205
+ readonly enableRoleManagement: true;
206
+ readonly enablePermissionManagement: true;
207
+ };
208
+ readonly authUtility: {
209
+ readonly sessionCookieName: "hazo_session";
210
+ readonly sessionDuration: 86400;
211
+ readonly requireEmailVerification: true;
212
+ };
213
+ readonly uiShell: {
214
+ readonly layout_mode: "standalone" | "test_sidebar";
215
+ readonly image_src: "/globe.svg";
216
+ readonly image_width: 400;
217
+ readonly image_height: 400;
218
+ readonly show_visual_panel: true;
219
+ };
220
+ readonly profilePicMenu: {
221
+ readonly show_single_button: false;
222
+ readonly sign_up_label: "Sign Up";
223
+ readonly sign_in_label: "Sign In";
224
+ readonly register_path: "/hazo_auth/register";
225
+ readonly login_path: "/hazo_auth/login";
226
+ readonly settings_path: "/hazo_auth/my_settings";
227
+ readonly logout_path: "/api/hazo_auth/logout";
228
+ };
229
+ readonly apiPaths: {
230
+ readonly apiBasePath: "/api/hazo_auth";
231
+ };
232
+ };
233
+ /**
234
+ * Type representing the complete default configuration structure
235
+ */
236
+ export type HazoAuthDefaults = typeof HAZO_AUTH_DEFAULTS;
237
+ //# sourceMappingURL=default_config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default_config.d.ts","sourceRoot":"","sources":["../../../src/lib/config/default_config.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,6BAA6B;;;;;;CAMhC,CAAC;AAGX,eAAO,MAAM,mBAAmB;;;;CAItB,CAAC;AAGX,eAAO,MAAM,uBAAuB;;;;;;;CAO1B,CAAC;AAGX,eAAO,MAAM,gBAAgB;;;;;;;;;CASnB,CAAC;AAGX,eAAO,MAAM,kBAAkB;;;CAGrB,CAAC;AAGX,eAAO,MAAM,gBAAgB;;;;;CAKnB,CAAC;AAGX,eAAO,MAAM,yBAAyB;;;;;;CAM5B,CAAC;AAGX,eAAO,MAAM,aAAa;4BACI,MAAM,GAAG,SAAS;;;;;;CAMtC,CAAC;AAGX,eAAO,MAAM,gBAAgB;4BACC,MAAM,GAAG,SAAS;;;;;CAKtC,CAAC;AAGX,eAAO,MAAM,uBAAuB;;;;CAI1B,CAAC;AAGX,eAAO,MAAM,sBAAsB;;;;CAIzB,CAAC;AAGX,eAAO,MAAM,0BAA0B;;;;;CAK7B,CAAC;AAGX,eAAO,MAAM,mBAAmB;;;;;CAKtB,CAAC;AAGX,eAAO,MAAM,uBAAuB;;;;CAI1B,CAAC;AAGX,eAAO,MAAM,oBAAoB;;;;CAIvB,CAAC;AAGX,eAAO,MAAM,gBAAgB;0BACE,YAAY,GAAG,cAAc;;;;;CAKlD,CAAC;AAGX,eAAO,MAAM,wBAAwB;;;;;;;;CAQ3B,CAAC;AAGX,eAAO,MAAM,iBAAiB;;CAEpB,CAAC;AAGX;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCA3FD,MAAM,GAAG,SAAS;;;;;;;;gCAUlB,MAAM,GAAG,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAqDjB,YAAY,GAAG,cAAc;;;;;;;;;;;;;;;;;;CA+ClD,CAAC;AAGX;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,kBAAkB,CAAC"}
@@ -0,0 +1,159 @@
1
+ // file_description: Centralized default configuration for hazo_auth
2
+ // All default values in one place for easy reference and maintenance
3
+ // These defaults are used when hazo_auth_config.ini is missing or incomplete
4
+ // section: password_requirements
5
+ export const DEFAULT_PASSWORD_REQUIREMENTS = {
6
+ minimum_length: 8,
7
+ require_uppercase: false,
8
+ require_lowercase: false,
9
+ require_number: false,
10
+ require_special: false,
11
+ };
12
+ // section: user_fields
13
+ export const DEFAULT_USER_FIELDS = {
14
+ show_name_field: true,
15
+ show_email_field: true,
16
+ show_password_field: true,
17
+ };
18
+ // section: profile_picture
19
+ export const DEFAULT_PROFILE_PICTURE = {
20
+ allow_photo_upload: true,
21
+ max_photo_size: 5242880, // 5MB in bytes
22
+ user_photo_default: true,
23
+ user_photo_default_priority1: "gravatar",
24
+ user_photo_default_priority2: "library",
25
+ library_photo_path: "/profile_pictures/library",
26
+ };
27
+ // section: ui_sizes
28
+ export const DEFAULT_UI_SIZES = {
29
+ gravatar_size: 200,
30
+ profile_picture_size: 128,
31
+ tooltip_icon_size_default: 16,
32
+ tooltip_icon_size_small: 14,
33
+ library_photo_grid_columns: 4,
34
+ library_photo_preview_size: 80,
35
+ image_compression_max_dimension: 800,
36
+ upload_file_hard_limit_bytes: 10485760, // 10MB
37
+ };
38
+ // section: file_types
39
+ export const DEFAULT_FILE_TYPES = {
40
+ allowed_image_extensions: [".jpg", ".jpeg", ".png", ".gif", ".webp"],
41
+ allowed_image_mime_types: ["image/jpeg", "image/png", "image/gif", "image/webp"],
42
+ };
43
+ // section: messages
44
+ export const DEFAULT_MESSAGES = {
45
+ photo_upload_disabled_message: "Photo upload is currently disabled. Contact your administrator.",
46
+ gravatar_setup_message: "To use Gravatar, create a free account at gravatar.com with the same email address you use here.",
47
+ gravatar_no_account_message: "No Gravatar account found for your email. Using library photo instead.",
48
+ library_tooltip_message: "Choose from our library of profile pictures",
49
+ };
50
+ // section: already_logged_in
51
+ export const DEFAULT_ALREADY_LOGGED_IN = {
52
+ message: "You are already logged in",
53
+ showLogoutButton: true,
54
+ showReturnHomeButton: true,
55
+ returnHomeButtonLabel: "Return Home",
56
+ returnHomePath: "/",
57
+ };
58
+ // section: login
59
+ export const DEFAULT_LOGIN = {
60
+ redirectRoute: undefined,
61
+ successMessage: "Successfully logged in",
62
+ forgotPasswordPath: "/hazo_auth/forgot_password",
63
+ forgotPasswordLabel: "Forgot password?",
64
+ createAccountPath: "/hazo_auth/register",
65
+ createAccountLabel: "Create account",
66
+ };
67
+ // section: register
68
+ export const DEFAULT_REGISTER = {
69
+ redirectRoute: undefined,
70
+ successMessage: "Registration successful! Please check your email to verify your account.",
71
+ loginPath: "/hazo_auth/login",
72
+ loginLabel: "Already have an account? Sign in",
73
+ requireEmailVerification: true,
74
+ };
75
+ // section: forgot_password
76
+ export const DEFAULT_FORGOT_PASSWORD = {
77
+ successMessage: "If an account with that email exists, a password reset link has been sent.",
78
+ loginPath: "/hazo_auth/login",
79
+ loginLabel: "Back to login",
80
+ };
81
+ // section: reset_password
82
+ export const DEFAULT_RESET_PASSWORD = {
83
+ successMessage: "Password reset successfully. You can now log in with your new password.",
84
+ loginPath: "/hazo_auth/login",
85
+ redirectDelay: 2, // seconds
86
+ };
87
+ // section: email_verification
88
+ export const DEFAULT_EMAIL_VERIFICATION = {
89
+ successMessage: "Email verified successfully! Redirecting to login...",
90
+ errorMessage: "Email verification failed. The link may have expired.",
91
+ loginPath: "/hazo_auth/login",
92
+ redirectDelay: 5, // seconds
93
+ };
94
+ // section: my_settings
95
+ export const DEFAULT_MY_SETTINGS = {
96
+ showNameField: true,
97
+ showEmailField: true,
98
+ showPasswordField: true,
99
+ showProfilePicture: true,
100
+ };
101
+ // section: user_management
102
+ export const DEFAULT_USER_MANAGEMENT = {
103
+ enableUserManagement: true,
104
+ enableRoleManagement: true,
105
+ enablePermissionManagement: true,
106
+ };
107
+ // section: auth_utility
108
+ export const DEFAULT_AUTH_UTILITY = {
109
+ sessionCookieName: "hazo_session",
110
+ sessionDuration: 86400, // 24 hours in seconds
111
+ requireEmailVerification: true,
112
+ };
113
+ // section: ui_shell
114
+ export const DEFAULT_UI_SHELL = {
115
+ layout_mode: "standalone",
116
+ image_src: "/globe.svg",
117
+ image_width: 400,
118
+ image_height: 400,
119
+ show_visual_panel: true,
120
+ };
121
+ // section: profile_pic_menu
122
+ export const DEFAULT_PROFILE_PIC_MENU = {
123
+ show_single_button: false,
124
+ sign_up_label: "Sign Up",
125
+ sign_in_label: "Sign In",
126
+ register_path: "/hazo_auth/register",
127
+ login_path: "/hazo_auth/login",
128
+ settings_path: "/hazo_auth/my_settings",
129
+ logout_path: "/api/hazo_auth/logout",
130
+ };
131
+ // section: api_paths
132
+ export const DEFAULT_API_PATHS = {
133
+ apiBasePath: "/api/hazo_auth",
134
+ };
135
+ // section: combined_defaults
136
+ /**
137
+ * All default configuration values combined in one object
138
+ * This makes it easy to see all defaults at a glance and export them as needed
139
+ */
140
+ export const HAZO_AUTH_DEFAULTS = {
141
+ passwordRequirements: DEFAULT_PASSWORD_REQUIREMENTS,
142
+ userFields: DEFAULT_USER_FIELDS,
143
+ profilePicture: DEFAULT_PROFILE_PICTURE,
144
+ uiSizes: DEFAULT_UI_SIZES,
145
+ fileTypes: DEFAULT_FILE_TYPES,
146
+ messages: DEFAULT_MESSAGES,
147
+ alreadyLoggedIn: DEFAULT_ALREADY_LOGGED_IN,
148
+ login: DEFAULT_LOGIN,
149
+ register: DEFAULT_REGISTER,
150
+ forgotPassword: DEFAULT_FORGOT_PASSWORD,
151
+ resetPassword: DEFAULT_RESET_PASSWORD,
152
+ emailVerification: DEFAULT_EMAIL_VERIFICATION,
153
+ mySettings: DEFAULT_MY_SETTINGS,
154
+ userManagement: DEFAULT_USER_MANAGEMENT,
155
+ authUtility: DEFAULT_AUTH_UTILITY,
156
+ uiShell: DEFAULT_UI_SHELL,
157
+ profilePicMenu: DEFAULT_PROFILE_PIC_MENU,
158
+ apiPaths: DEFAULT_API_PATHS,
159
+ };
@@ -1,9 +1,13 @@
1
+ import type { StaticImageData } from "next/image";
1
2
  export type EmailVerificationConfig = {
2
3
  alreadyLoggedInMessage: string;
3
4
  showLogoutButton: boolean;
4
5
  showReturnHomeButton: boolean;
5
6
  returnHomeButtonLabel: string;
6
7
  returnHomePath: string;
8
+ imageSrc: string | StaticImageData;
9
+ imageAlt: string;
10
+ imageBackgroundColor: string;
7
11
  };
8
12
  /**
9
13
  * Reads email verification layout configuration from hazo_auth_config.ini file
@@ -1 +1 @@
1
- {"version":3,"file":"email_verification_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/email_verification_config.server.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,uBAAuB,GAAG;IACpC,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;CACxB,CAAC;AAGF;;;;GAIG;AACH,wBAAgB,6BAA6B,IAAI,uBAAuB,CAWvE"}
1
+ {"version":3,"file":"email_verification_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/email_verification_config.server.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,MAAM,uBAAuB,GAAG;IACpC,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,QAAQ,EAAE,MAAM,GAAG,eAAe,CAAC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC;AAGF;;;;GAIG;AACH,wBAAgB,6BAA6B,IAAI,uBAAuB,CAmCvE"}
@@ -1,6 +1,8 @@
1
1
  // file_description: server-only helper to read email verification layout configuration from hazo_auth_config.ini
2
2
  // section: imports
3
3
  import { get_already_logged_in_config } from "./already_logged_in_config.server";
4
+ import { get_config_value } from "./config/config_loader.server";
5
+ import verifyEmailDefaultImage from "../assets/images/verify_email_default.jpg";
4
6
  // section: helpers
5
7
  /**
6
8
  * Reads email verification layout configuration from hazo_auth_config.ini file
@@ -8,13 +10,23 @@ import { get_already_logged_in_config } from "./already_logged_in_config.server"
8
10
  * @returns Email verification configuration options
9
11
  */
10
12
  export function get_email_verification_config() {
13
+ const section = "hazo_auth__email_verification_layout";
11
14
  // Get shared already logged in config
12
15
  const alreadyLoggedInConfig = get_already_logged_in_config();
16
+ // Read image configuration
17
+ // If not set in config, falls back to default image from assets
18
+ const imageSrc = get_config_value(section, "image_src", "" // Empty string means not set in config
19
+ ) || verifyEmailDefaultImage;
20
+ const imageAlt = get_config_value(section, "image_alt", "Email verification illustration");
21
+ const imageBackgroundColor = get_config_value(section, "image_background_color", "#f1f5f9");
13
22
  return {
14
23
  alreadyLoggedInMessage: alreadyLoggedInConfig.message,
15
24
  showLogoutButton: alreadyLoggedInConfig.showLogoutButton,
16
25
  showReturnHomeButton: alreadyLoggedInConfig.showReturnHomeButton,
17
26
  returnHomeButtonLabel: alreadyLoggedInConfig.returnHomeButtonLabel,
18
27
  returnHomePath: alreadyLoggedInConfig.returnHomePath,
28
+ imageSrc,
29
+ imageAlt,
30
+ imageBackgroundColor,
19
31
  };
20
32
  }
@@ -1,9 +1,13 @@
1
+ import type { StaticImageData } from "next/image";
1
2
  export type ForgotPasswordConfig = {
2
3
  alreadyLoggedInMessage: string;
3
4
  showLogoutButton: boolean;
4
5
  showReturnHomeButton: boolean;
5
6
  returnHomeButtonLabel: string;
6
7
  returnHomePath: string;
8
+ imageSrc: string | StaticImageData;
9
+ imageAlt: string;
10
+ imageBackgroundColor: string;
7
11
  };
8
12
  /**
9
13
  * Reads forgot password layout configuration from hazo_auth_config.ini file
@@ -1 +1 @@
1
- {"version":3,"file":"forgot_password_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/forgot_password_config.server.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,oBAAoB,GAAG;IACjC,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;CACxB,CAAC;AAGF;;;;GAIG;AACH,wBAAgB,0BAA0B,IAAI,oBAAoB,CAWjE"}
1
+ {"version":3,"file":"forgot_password_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/forgot_password_config.server.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,MAAM,oBAAoB,GAAG;IACjC,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,QAAQ,EAAE,MAAM,GAAG,eAAe,CAAC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC;AAGF;;;;GAIG;AACH,wBAAgB,0BAA0B,IAAI,oBAAoB,CAmCjE"}