hazo_auth 0.1.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 (162) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +48 -0
  3. package/components.json +22 -0
  4. package/hazo_auth_config.example.ini +414 -0
  5. package/hazo_notify_config.example.ini +159 -0
  6. package/instrumentation.ts +32 -0
  7. package/migrations/001_add_token_type_to_refresh_tokens.sql +14 -0
  8. package/migrations/002_add_name_to_hazo_users.sql +7 -0
  9. package/next.config.mjs +55 -0
  10. package/package.json +114 -0
  11. package/postcss.config.mjs +8 -0
  12. package/public/file.svg +1 -0
  13. package/public/globe.svg +1 -0
  14. package/public/next.svg +1 -0
  15. package/public/vercel.svg +1 -0
  16. package/public/window.svg +1 -0
  17. package/scripts/apply_migration.ts +118 -0
  18. package/src/app/api/auth/change_password/route.ts +109 -0
  19. package/src/app/api/auth/forgot_password/route.ts +107 -0
  20. package/src/app/api/auth/library_photos/route.ts +70 -0
  21. package/src/app/api/auth/login/route.ts +155 -0
  22. package/src/app/api/auth/logout/route.ts +62 -0
  23. package/src/app/api/auth/me/route.ts +47 -0
  24. package/src/app/api/auth/profile_picture/[filename]/route.ts +67 -0
  25. package/src/app/api/auth/register/route.ts +106 -0
  26. package/src/app/api/auth/remove_profile_picture/route.ts +86 -0
  27. package/src/app/api/auth/resend_verification/route.ts +107 -0
  28. package/src/app/api/auth/reset_password/route.ts +107 -0
  29. package/src/app/api/auth/update_user/route.ts +126 -0
  30. package/src/app/api/auth/upload_profile_picture/route.ts +268 -0
  31. package/src/app/api/auth/validate_reset_token/route.ts +80 -0
  32. package/src/app/api/auth/verify_email/route.ts +85 -0
  33. package/src/app/api/migrations/apply/route.ts +91 -0
  34. package/src/app/favicon.ico +0 -0
  35. package/src/app/fonts/GeistMonoVF.woff +0 -0
  36. package/src/app/fonts/GeistVF.woff +0 -0
  37. package/src/app/forgot_password/forgot_password_page_client.tsx +60 -0
  38. package/src/app/forgot_password/page.tsx +24 -0
  39. package/src/app/globals.css +89 -0
  40. package/src/app/hazo_connect/api/sqlite/data/route.ts +197 -0
  41. package/src/app/hazo_connect/api/sqlite/schema/route.ts +35 -0
  42. package/src/app/hazo_connect/api/sqlite/tables/route.ts +26 -0
  43. package/src/app/hazo_connect/sqlite_admin/page.tsx +51 -0
  44. package/src/app/hazo_connect/sqlite_admin/sqlite-admin-client.tsx +947 -0
  45. package/src/app/layout.tsx +43 -0
  46. package/src/app/login/login_page_client.tsx +71 -0
  47. package/src/app/login/page.tsx +26 -0
  48. package/src/app/my_settings/my_settings_page_client.tsx +120 -0
  49. package/src/app/my_settings/page.tsx +40 -0
  50. package/src/app/page.tsx +170 -0
  51. package/src/app/register/page.tsx +26 -0
  52. package/src/app/register/register_page_client.tsx +72 -0
  53. package/src/app/reset_password/page.tsx +29 -0
  54. package/src/app/reset_password/reset_password_page_client.tsx +81 -0
  55. package/src/app/verify_email/page.tsx +24 -0
  56. package/src/app/verify_email/verify_email_page_client.tsx +60 -0
  57. package/src/components/layouts/email_verification/config/email_verification_field_config.ts +86 -0
  58. package/src/components/layouts/email_verification/hooks/use_email_verification.ts +291 -0
  59. package/src/components/layouts/email_verification/index.tsx +297 -0
  60. package/src/components/layouts/forgot_password/config/forgot_password_field_config.ts +58 -0
  61. package/src/components/layouts/forgot_password/hooks/use_forgot_password_form.ts +179 -0
  62. package/src/components/layouts/forgot_password/index.tsx +168 -0
  63. package/src/components/layouts/login/config/login_field_config.ts +67 -0
  64. package/src/components/layouts/login/hooks/use_login_form.ts +281 -0
  65. package/src/components/layouts/login/index.tsx +224 -0
  66. package/src/components/layouts/my_settings/components/editable_field.tsx +177 -0
  67. package/src/components/layouts/my_settings/components/password_change_dialog.tsx +301 -0
  68. package/src/components/layouts/my_settings/components/profile_picture_dialog.tsx +385 -0
  69. package/src/components/layouts/my_settings/components/profile_picture_display.tsx +66 -0
  70. package/src/components/layouts/my_settings/components/profile_picture_gravatar_tab.tsx +143 -0
  71. package/src/components/layouts/my_settings/components/profile_picture_library_tab.tsx +282 -0
  72. package/src/components/layouts/my_settings/components/profile_picture_upload_tab.tsx +341 -0
  73. package/src/components/layouts/my_settings/config/my_settings_field_config.ts +61 -0
  74. package/src/components/layouts/my_settings/hooks/use_my_settings.ts +458 -0
  75. package/src/components/layouts/my_settings/index.tsx +351 -0
  76. package/src/components/layouts/register/config/register_field_config.ts +101 -0
  77. package/src/components/layouts/register/hooks/use_register_form.ts +272 -0
  78. package/src/components/layouts/register/index.tsx +208 -0
  79. package/src/components/layouts/reset_password/config/reset_password_field_config.ts +86 -0
  80. package/src/components/layouts/reset_password/hooks/use_reset_password_form.ts +276 -0
  81. package/src/components/layouts/reset_password/index.tsx +294 -0
  82. package/src/components/layouts/shared/components/already_logged_in_guard.tsx +95 -0
  83. package/src/components/layouts/shared/components/field_error_message.tsx +29 -0
  84. package/src/components/layouts/shared/components/form_action_buttons.tsx +64 -0
  85. package/src/components/layouts/shared/components/form_field_wrapper.tsx +44 -0
  86. package/src/components/layouts/shared/components/form_header.tsx +36 -0
  87. package/src/components/layouts/shared/components/logout_button.tsx +76 -0
  88. package/src/components/layouts/shared/components/password_field.tsx +72 -0
  89. package/src/components/layouts/shared/components/sidebar_layout_wrapper.tsx +264 -0
  90. package/src/components/layouts/shared/components/two_column_auth_layout.tsx +44 -0
  91. package/src/components/layouts/shared/components/unauthorized_guard.tsx +78 -0
  92. package/src/components/layouts/shared/components/visual_panel.tsx +41 -0
  93. package/src/components/layouts/shared/config/layout_customization.ts +95 -0
  94. package/src/components/layouts/shared/data/layout_data_client.ts +19 -0
  95. package/src/components/layouts/shared/hooks/use_auth_status.ts +103 -0
  96. package/src/components/layouts/shared/utils/ip_address.ts +37 -0
  97. package/src/components/layouts/shared/utils/validation.ts +66 -0
  98. package/src/components/ui/avatar.tsx +50 -0
  99. package/src/components/ui/button.tsx +57 -0
  100. package/src/components/ui/dialog.tsx +122 -0
  101. package/src/components/ui/hazo_ui_tooltip.tsx +67 -0
  102. package/src/components/ui/input.tsx +22 -0
  103. package/src/components/ui/label.tsx +26 -0
  104. package/src/components/ui/separator.tsx +31 -0
  105. package/src/components/ui/sheet.tsx +139 -0
  106. package/src/components/ui/sidebar.tsx +773 -0
  107. package/src/components/ui/skeleton.tsx +15 -0
  108. package/src/components/ui/sonner.tsx +31 -0
  109. package/src/components/ui/switch.tsx +29 -0
  110. package/src/components/ui/tabs.tsx +55 -0
  111. package/src/components/ui/tooltip.tsx +32 -0
  112. package/src/components/ui/vertical-tabs.tsx +59 -0
  113. package/src/hooks/use-mobile.tsx +19 -0
  114. package/src/lib/already_logged_in_config.server.ts +46 -0
  115. package/src/lib/app_logger.ts +24 -0
  116. package/src/lib/auth/auth_utils.server.ts +196 -0
  117. package/src/lib/auth/server_auth.ts +88 -0
  118. package/src/lib/config/config_loader.server.ts +149 -0
  119. package/src/lib/email_verification_config.server.ts +32 -0
  120. package/src/lib/file_types_config.server.ts +25 -0
  121. package/src/lib/forgot_password_config.server.ts +32 -0
  122. package/src/lib/hazo_connect_instance.server.ts +77 -0
  123. package/src/lib/hazo_connect_setup.server.ts +181 -0
  124. package/src/lib/hazo_connect_setup.ts +54 -0
  125. package/src/lib/login_config.server.ts +46 -0
  126. package/src/lib/messages_config.server.ts +45 -0
  127. package/src/lib/migrations/apply_migration.ts +105 -0
  128. package/src/lib/my_settings_config.server.ts +135 -0
  129. package/src/lib/password_requirements_config.server.ts +39 -0
  130. package/src/lib/profile_picture_config.server.ts +56 -0
  131. package/src/lib/register_config.server.ts +57 -0
  132. package/src/lib/reset_password_config.server.ts +75 -0
  133. package/src/lib/services/email_service.ts +581 -0
  134. package/src/lib/services/email_verification_service.ts +264 -0
  135. package/src/lib/services/login_service.ts +118 -0
  136. package/src/lib/services/password_change_service.ts +154 -0
  137. package/src/lib/services/password_reset_service.ts +405 -0
  138. package/src/lib/services/profile_picture_remove_service.ts +120 -0
  139. package/src/lib/services/profile_picture_service.ts +215 -0
  140. package/src/lib/services/profile_picture_source_mapper.ts +62 -0
  141. package/src/lib/services/registration_service.ts +163 -0
  142. package/src/lib/services/token_service.ts +240 -0
  143. package/src/lib/services/user_update_service.ts +128 -0
  144. package/src/lib/ui_sizes_config.server.ts +37 -0
  145. package/src/lib/user_fields_config.server.ts +31 -0
  146. package/src/lib/utils/api_route_helpers.ts +60 -0
  147. package/src/lib/utils.ts +11 -0
  148. package/src/middleware.ts +91 -0
  149. package/src/server/config/config_loader.ts +496 -0
  150. package/src/server/index.ts +38 -0
  151. package/src/server/logging/logger_service.ts +56 -0
  152. package/src/server/routes/root_router.ts +16 -0
  153. package/src/server/server.ts +28 -0
  154. package/src/server/types/app_types.ts +74 -0
  155. package/src/server/types/express.d.ts +15 -0
  156. package/src/stories/email_verification_layout.stories.tsx +137 -0
  157. package/src/stories/forgot_password_layout.stories.tsx +85 -0
  158. package/src/stories/login_layout.stories.tsx +85 -0
  159. package/src/stories/project_overview.stories.tsx +33 -0
  160. package/src/stories/register_layout.stories.tsx +107 -0
  161. package/tailwind.config.ts +77 -0
  162. package/tsconfig.json +27 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 pub12
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,48 @@
1
+ ## hazo_auth - Authentication UI Component Package
2
+
3
+ A reusable authentication UI component package powered by Next.js, TailwindCSS, and shadcn. It integrates `hazo_config` for configuration management and `hazo_connect` for data access, enabling future components to stay aligned with platform conventions.
4
+
5
+ ### Installation
6
+
7
+ ```bash
8
+ npm install hazo_auth
9
+ ```
10
+
11
+ ### Configuration Setup
12
+
13
+ After installing the package, you need to set up configuration files in your project root:
14
+
15
+ 1. **Copy the example config files to your project root:**
16
+ ```bash
17
+ cp node_modules/hazo_auth/hazo_auth_config.example.ini ./hazo_auth_config.ini
18
+ cp node_modules/hazo_auth/hazo_notify_config.example.ini ./hazo_notify_config.ini
19
+ ```
20
+
21
+ 2. **Customize the configuration files:**
22
+ - Edit `hazo_auth_config.ini` to configure authentication settings, database connection, UI labels, and more
23
+ - Edit `hazo_notify_config.ini` to configure email service settings (Zeptomail, SMTP, etc.)
24
+
25
+ 3. **Set up environment variables (recommended for sensitive data):**
26
+ - Create a `.env.local` file in your project root
27
+ - Add `ZEPTOMAIL_API_KEY=your_api_key_here` (if using Zeptomail)
28
+ - Add other sensitive configuration values as needed
29
+
30
+ **Important:** The configuration files must be located in your project root directory (where `process.cwd()` points to), not inside `node_modules`. The package reads configuration from `process.cwd()` at runtime.
31
+
32
+ ### Local Development (for package contributors)
33
+
34
+ - `npm install` to install dependencies.
35
+ - `npm run dev` launches the Next.js app at `http://localhost:3000`.
36
+ - `npm run storybook` launches Storybook at `http://localhost:6006`.
37
+
38
+ ### Project Structure
39
+
40
+ - `src/app` contains the application shell and route composition.
41
+ - `src/stories` holds Storybook stories for documenting components.
42
+ - `src/lib` is the home for shared utilities.
43
+
44
+ ### Next Steps
45
+
46
+ - Use `npx shadcn@latest add <component>` to scaffold new UI primitives.
47
+ - Centralize configurable values through `hazo_config`.
48
+ - Access backend resources exclusively via `hazo_connect`.
@@ -0,0 +1,22 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema.json",
3
+ "style": "new-york",
4
+ "rsc": true,
5
+ "tsx": true,
6
+ "tailwind": {
7
+ "config": "tailwind.config.ts",
8
+ "css": "src/app/globals.css",
9
+ "baseColor": "neutral",
10
+ "cssVariables": true,
11
+ "prefix": ""
12
+ },
13
+ "iconLibrary": "lucide",
14
+ "aliases": {
15
+ "components": "@/components",
16
+ "utils": "@/lib/utils",
17
+ "ui": "@/components/ui",
18
+ "lib": "@/lib",
19
+ "hooks": "@/hooks"
20
+ },
21
+ "registries": {}
22
+ }
@@ -0,0 +1,414 @@
1
+ # file_description: example configuration file for hazo_auth
2
+ # This file contains all configurable parameters for the application
3
+ # Copy this file to your project root as hazo_auth_config.ini and customize the values
4
+ # Commented values indicate defaults that are being used
5
+
6
+ [hazo_connect]
7
+ # Database type: sqlite, postgrest, supabase, or file
8
+ type = sqlite
9
+
10
+ # SQLite database configuration
11
+ # Path to SQLite database file (relative to process.cwd() or absolute)
12
+ sqlite_path = ./data/hazo_auth.sqlite
13
+
14
+ # Enable SQLite admin UI (true/false)
15
+ enable_admin_ui = true
16
+
17
+ # SQLite read-only mode (true/false)
18
+ # read_only = false
19
+
20
+ # PostgREST configuration (uncomment if using postgrest type)
21
+ # postgrest_url =
22
+ # postgrest_api_key =
23
+
24
+ [hazo_auth__register_layout]
25
+ # Image configuration
26
+ # image_src = /globe.svg
27
+ # image_alt = Illustration of a globe representing secure authentication workflows
28
+ # image_background_color = #e2e8f0
29
+
30
+ # Labels
31
+ # heading = Create your hazo account
32
+ # sub_heading = Secure your access with editable fields powered by shadcn components.
33
+ # submit_button = Register
34
+ # cancel_button = Cancel
35
+
36
+ # Field labels (defaults shown, uncomment to override)
37
+ # name_label = Full name
38
+ # name_placeholder = Enter your full name
39
+ # email_label = Email address
40
+ # email_placeholder = Enter your email address
41
+ # password_label = Password
42
+ # password_placeholder = Enter your password
43
+ # confirm_password_label = Re-enter password
44
+ # confirm_password_placeholder = Re-enter your password
45
+
46
+ # Button colors
47
+ # submit_background = #0f172a
48
+ # submit_text = #ffffff
49
+ # cancel_border = #cbd5f5
50
+ # cancel_text = #0f172a
51
+
52
+ # Show name field (true/false)
53
+ # Note: This is now deprecated, use hazo_auth__user_fields section instead
54
+ # show_name_field = false
55
+
56
+ [hazo_auth__user_fields]
57
+ # Shared user fields configuration used by register and my_settings layouts
58
+ # Show name field (true/false, default: true)
59
+ # show_name_field = true
60
+
61
+ # Show email field (true/false, default: true)
62
+ # show_email_field = true
63
+
64
+ # Show password field (true/false, default: true)
65
+ # show_password_field = true
66
+
67
+ [hazo_auth__password_requirements]
68
+ # Shared password requirements used by register and reset password layouts
69
+ # minimum_length = 8
70
+ # require_uppercase = false
71
+ # require_lowercase = false
72
+ # require_number = false
73
+ # require_special = false
74
+
75
+ [hazo_auth__login_layout]
76
+ # Image configuration
77
+ # image_src = /globe.svg
78
+ # image_alt = Illustration of a globe representing secure authentication workflows
79
+ # image_background_color = #e2e8f0
80
+
81
+ # Labels
82
+ # heading = Sign in to your account
83
+ # sub_heading = Enter your credentials to access your secure workspace.
84
+ # submit_button = Login
85
+ # cancel_button = Cancel
86
+
87
+ # Field labels (defaults shown, uncomment to override)
88
+ # email_label = Email address
89
+ # email_placeholder = Enter your email address
90
+ # password_label = Password
91
+ # password_placeholder = Enter your password
92
+
93
+ # Button colors
94
+ # submit_background = #0f172a
95
+ # submit_text = #ffffff
96
+ # cancel_border = #cbd5f5
97
+ # cancel_text = #0f172a
98
+
99
+ # Redirect on successful login (leave empty to show success message instead)
100
+ # redirect_route_on_successful_login = /
101
+
102
+ # Success message (shown when no redirect route is provided)
103
+ # success_message = Successfully logged in
104
+
105
+ [hazo_auth__forgot_password_layout]
106
+ # Image configuration
107
+ # image_src = /globe.svg
108
+ # image_alt = Illustration of a globe representing secure authentication workflows
109
+ # image_background_color = #e2e8f0
110
+
111
+ # Labels
112
+ # heading = Forgot your password?
113
+ # sub_heading = Enter your email address and we'll send you a link to reset your password.
114
+ # submit_button = Send reset link
115
+ # cancel_button = Cancel
116
+
117
+ [hazo_auth__reset_password_layout]
118
+ # Image configuration
119
+ # image_src = /globe.svg
120
+ # image_alt = Illustration of a globe representing secure authentication workflows
121
+ # image_background_color = #e2e8f0
122
+
123
+ # Labels
124
+ # heading = Reset your password
125
+ # sub_heading = Enter your new password below.
126
+ # submit_button = Reset password
127
+ # cancel_button = Cancel
128
+
129
+ # Field labels (defaults shown, uncomment to override)
130
+ # password_label = New password
131
+ # password_placeholder = Enter your new password
132
+ # confirm_password_label = Confirm new password
133
+ # confirm_password_placeholder = Re-enter your new password
134
+
135
+ # Button colors
136
+ # submit_background = #0f172a
137
+ # submit_text = #ffffff
138
+ # cancel_border = #cbd5f5
139
+ # cancel_text = #0f172a
140
+
141
+ # Error message (shown when token is invalid or missing)
142
+ # error_message = Reset password link invalid or has expired. Please go to Reset Password page to get a new link.
143
+
144
+ # Success message (shown after successful password reset)
145
+ # success_message = Password reset successfully. Redirecting to login...
146
+
147
+ # Login path (redirect target after successful reset)
148
+ # login_path = /login
149
+
150
+ # Forgot password path (link shown in error state)
151
+ # forgot_password_path = /forgot_password
152
+
153
+ [hazo_auth__email_verification_layout]
154
+ # Image configuration
155
+ # image_src = /globe.svg
156
+ # image_alt = Illustration of a globe representing secure authentication workflows
157
+ # image_background_color = #e2e8f0
158
+
159
+ # Labels (verifying state)
160
+ # heading = Email verification
161
+ # sub_heading = Verifying your email address...
162
+ # submit_button = Resend verification email
163
+ # cancel_button = Cancel
164
+
165
+ # Success labels
166
+ # success_heading = Email verified successfully
167
+ # success_message = Your email address has been verified. You can now log in to your account.
168
+ # success_redirect_message = Redirecting to login page in
169
+ # success_go_to_login_button = Go to login
170
+
171
+ # Error labels
172
+ # error_heading = Verification failed
173
+ # error_message = The verification link is invalid or has expired.
174
+ # error_resend_form_heading = Resend verification email
175
+
176
+ # Field labels (defaults shown, uncomment to override)
177
+ # email_label = Email address
178
+ # email_placeholder = Enter your email address
179
+
180
+ # Button colors
181
+ # submit_background = #0f172a
182
+ # submit_text = #ffffff
183
+ # cancel_border = #cbd5f5
184
+ # cancel_text = #0f172a
185
+
186
+ # Redirect delay in seconds (default: 5)
187
+ # redirect_delay = 5
188
+
189
+ # Login path for redirect (default: /login)
190
+ # login_path = /login
191
+
192
+ [hazo_auth__already_logged_in]
193
+ # Message shown when user is already logged in (used across all auth pages)
194
+ # message = You're already logged in.
195
+
196
+ # Show logout button (true/false)
197
+ # show_logout_button = true
198
+
199
+ # Show return home button (true/false)
200
+ # show_return_home_button = false
201
+
202
+ # Return home button label
203
+ # return_home_button_label = Return home
204
+
205
+ # Return home path
206
+ # return_home_path = /
207
+
208
+ [hazo_auth__my_settings_layout]
209
+ # My Settings layout configuration
210
+
211
+ # Note: This layout uses shared configuration from:
212
+ # - [hazo_auth__user_fields] for field visibility (show_name_field, show_email_field, show_password_field)
213
+ # - [hazo_auth__password_requirements] for password validation rules
214
+ # - [hazo_auth__profile_picture] for profile picture settings and prioritization
215
+
216
+ # Heading
217
+ # heading = Account Settings
218
+
219
+ # Sub heading
220
+ # sub_heading = Manage your profile, password, and email preferences.
221
+
222
+ # Profile Photo section
223
+ # profile_photo_label = Profile Photo
224
+ # profile_photo_recommendation = Recommended size: 200x200px. JPG, PNG.
225
+ # Note: profile_photo_recommendation is currently not displayed in the UI (removed per user request)
226
+ # upload_photo_button_label = Upload New Photo
227
+ # remove_photo_button_label = Remove
228
+
229
+ # Profile Information section
230
+ # profile_information_label = Profile Information
231
+ # Note: Field visibility is controlled by [hazo_auth__user_fields] section:
232
+ # - show_name_field (controls Full Name field visibility)
233
+ # - show_email_field (controls Email Address field visibility)
234
+ # Note: Name and email field labels are currently hardcoded in the component
235
+
236
+ # Password section
237
+ # password_label = Password
238
+ # current_password_label = Current Password
239
+ # new_password_label = New Password
240
+ # confirm_password_label = Confirm Password
241
+ # save_password_button_label = Save Password
242
+ # Note: Field visibility is controlled by [hazo_auth__user_fields] show_password_field
243
+ # Note: Password requirements are controlled by [hazo_auth__password_requirements]
244
+
245
+ # Unauthorized message (shown when user is not logged in)
246
+ # unauthorized_message = You must be logged in to access this page.
247
+
248
+ # Login button label (shown in unauthorized message)
249
+ # login_button_label = Go to login
250
+
251
+ # Login path (redirect target in unauthorized message)
252
+ # login_path = /login
253
+
254
+ [hazo_auth__profile_picture]
255
+ # Profile picture configuration
256
+ # This configuration is used by:
257
+ # - Registration service (for default photo assignment)
258
+ # - My Settings layout (for profile picture management)
259
+
260
+ # Allow photo upload (true/false, default: false)
261
+ # When enabled, users can upload their own profile pictures
262
+ # allow_photo_upload = false
263
+
264
+ # Upload photo path (required if allow_photo_upload is true)
265
+ # Path should be outside the component package (e.g., ./uploads/profile_pictures/)
266
+ # Can be relative to process.cwd() or absolute path
267
+ # upload_photo_path = ./uploads/profile_pictures
268
+
269
+ # Maximum photo size in bytes (default: 51200 = 50kb)
270
+ # Photos larger than this will be compressed automatically
271
+ # max_photo_size = 51200
272
+
273
+ # Enable default photo assignment on user creation (true/false, default: true)
274
+ # When enabled, new users will automatically get a profile picture based on priority settings
275
+ # user_photo_default = true
276
+
277
+ # Default photo priority 1 (gravatar or library, default: gravatar)
278
+ # This is the first source tried when assigning a default profile picture
279
+ # Options: "gravatar" or "library"
280
+ # user_photo_default_priority1 = gravatar
281
+
282
+ # Default photo priority 2 (library or gravatar, optional)
283
+ # This is the fallback source if priority 1 fails or is not available
284
+ # Options: "library" or "gravatar"
285
+ # Leave commented to disable fallback (only priority 1 will be tried)
286
+ # user_photo_default_priority2 = library
287
+
288
+ # Library photo path relative to public directory (default: /profile_pictures/library)
289
+ # Photos should be organized in category subdirectories (e.g., /profile_pictures/library/Cars/)
290
+ # library_photo_path = /profile_pictures/library
291
+
292
+ [hazo_auth__tokens]
293
+ # Token expiry configuration (in hours)
294
+ # Default expiry times:
295
+ # - refresh: 720 hours (30 days)
296
+ # - password_reset: 0.167 hours (10 minutes)
297
+ # - email_verification: 48 hours
298
+
299
+ # Refresh token expiry (hours)
300
+ # refresh_expiry_hours = 720
301
+
302
+ # Password reset token expiry (hours, default: 10 minutes = 0.167 hours)
303
+ # password_reset_expiry_hours = 0.167
304
+
305
+ # Email verification token expiry (hours)
306
+ # email_verification_expiry_hours = 48
307
+
308
+ [hazo_auth__messages]
309
+ # User-facing messages used across the application
310
+ # Photo upload disabled message
311
+ # photo_upload_disabled_message = Photo upload is not enabled. Please contact your administrator.
312
+
313
+ # Gravatar messages
314
+ # gravatar_setup_message = To set up your Gravatar:
315
+ # gravatar_no_account_message = You don't have a Gravatar account set up for this email address.
316
+
317
+ # Library tooltip message
318
+ # library_tooltip_message = Select another tab image style to remove this image
319
+
320
+ [hazo_auth__ui_sizes]
321
+ # UI size configuration (in pixels)
322
+ # Gravatar image size (default: 200)
323
+ # gravatar_size = 200
324
+
325
+ # Profile picture size (default: 200)
326
+ # profile_picture_size = 200
327
+
328
+ # Tooltip icon sizes
329
+ # tooltip_icon_size_default = 16
330
+ # tooltip_icon_size_small = 14
331
+
332
+ # Library photo grid configuration
333
+ # library_photo_grid_columns = 4
334
+ # library_photo_preview_size = 200
335
+
336
+ # Image compression max width/height (default: 200)
337
+ # image_compression_max_dimension = 200
338
+
339
+ # Upload file hard limit in bytes (default: 10485760 = 10MB)
340
+ # upload_file_hard_limit_bytes = 10485760
341
+
342
+ [hazo_auth__file_types]
343
+ # Allowed file extensions and MIME types
344
+ # Allowed image extensions (comma-separated, default: jpg,jpeg,png)
345
+ # allowed_image_extensions = jpg,jpeg,png
346
+
347
+ # Allowed image MIME types (comma-separated, default: image/jpeg,image/jpg,image/png)
348
+ # allowed_image_mime_types = image/jpeg,image/jpg,image/png
349
+
350
+ [hazo_auth__email]
351
+ # Email configuration for verification, password reset, and password changed notification emails
352
+ # Emails are sent using hazo_notify (configured in hazo_notify_config.ini)
353
+
354
+ # Email from address (optional: overrides hazo_notify_config.ini from_email setting)
355
+ # Priority: 1. hazo_auth__email.from_email, 2. hazo_notify_config.ini from_email
356
+ # If not set, uses hazo_notify_config.ini from_email setting
357
+ # from_email = noreply@example.com
358
+ # from_name = Your App Name
359
+
360
+ # Base URL for email links (default: empty, uses relative URLs)
361
+ # If provided, this will be used to construct absolute URLs for verification and password reset links
362
+ # Priority: 1. hazo_auth__email.base_url, 2. APP_DOMAIN_NAME env var, 3. NEXT_PUBLIC_APP_URL/APP_URL env vars
363
+ # Example: https://example.com
364
+ # base_url = https://example.com
365
+
366
+ # Email template main directory (default: ./email_templates)
367
+ # This directory should contain email template files (HTML and text)
368
+ # Template files should be named: <template_type>.html and <template_type>.txt
369
+ # Example: email_verification.html, email_verification.txt, forgot_password.html, forgot_password.txt
370
+ # email_template_main_directory = ./email_templates
371
+
372
+ ### Email Template: Email Verification ###
373
+ # Email template configuration for email verification
374
+ # This config key enables custom templates for email verification emails
375
+ # If set, the service will look for email_verification.html and email_verification.txt in the template directory
376
+ # email_template__email_verification = email_verification
377
+
378
+ # Email subject for email verification (default: "Verify Your Email Address")
379
+ # email_template__email_verification__subject = Verify Your Email Address
380
+
381
+ # Template variables available in email_verification template:
382
+ # - {{token}} - The verification token
383
+ # - {{verification_url}} - Full URL for email verification
384
+ # - {{user_email}} - User's email address
385
+ # - {{user_name}} - User's name (if available)
386
+
387
+ ### Email Template: Forgot Password ###
388
+ # Email template configuration for forgot password
389
+ # This config key enables custom templates for forgot password emails
390
+ # If set, the service will look for forgot_password.html and forgot_password.txt in the template directory
391
+ # email_template__forgot_password = forgot_password
392
+
393
+ # Email subject for forgot password (default: "Reset Your Password")
394
+ # email_template__forgot_password__subject = Reset Your Password
395
+
396
+ # Template variables available in forgot_password template:
397
+ # - {{token}} - The password reset token
398
+ # - {{reset_url}} - Full URL for password reset
399
+ # - {{user_email}} - User's email address
400
+ # - {{user_name}} - User's name (if available)
401
+
402
+ ### Email Template: Password Changed ###
403
+ # Email template configuration for password changed notification
404
+ # This config key enables custom templates for password changed notification emails
405
+ # If set, the service will look for password_changed.html and password_changed.txt in the template directory
406
+ # email_template__password_changed = password_changed
407
+
408
+ # Email subject for password changed notification (default: "Password Changed Successfully")
409
+ # email_template__password_changed__subject = Password Changed Successfully
410
+
411
+ # Template variables available in password_changed template:
412
+ # - {{user_email}} - User's email address
413
+ # - {{user_name}} - User's name (if available)
414
+
@@ -0,0 +1,159 @@
1
+ # file_description: example configuration file for hazo_notify email service
2
+ # This file contains all configurable parameters for the hazo_notify email service
3
+ # Copy this file to your project root as hazo_notify_config.ini and customize the values
4
+ # Commented values indicate defaults that are being used
5
+
6
+ [emailer]
7
+ # Emailer module: zeptoemail_api, smtp, pop3
8
+ # Required: Yes
9
+ # Default: zeptoemail_api
10
+ # Description: Select the emailer module to use
11
+ # emailer_module=zeptoemail_api
12
+
13
+ # Zeptomail API Provider Configuration
14
+ # Required when emailer_module=zeptoemail_api
15
+ # Description: API endpoint for Zeptomail email service
16
+ # zeptomail_api_endpoint=https://api.zeptomail.com.au/v1.1/email
17
+
18
+ # Required when emailer_module=zeptoemail_api
19
+ # Description: Zeptomail API key for authentication
20
+ # SECURITY: Store this in .env.local file as ZEPTOMAIL_API_KEY (recommended)
21
+ # Get this from your Zeptomail account dashboard
22
+ # If not set in .env.local, you can set it here (not recommended for production)
23
+ # zeptomail_api_key=your_zeptomail_api_key
24
+
25
+ # Required: Yes
26
+ # Description: Default sender email address
27
+ # This email must be verified in your Zeptomail account
28
+ # from_email=noreply@example.com
29
+
30
+ # Required: Yes
31
+ # Description: Default sender name displayed in email clients
32
+ # from_name=Your App Name
33
+
34
+ # Optional: Reply-to email address
35
+ # Description: Email address to use for replies (if different from from_email)
36
+ # Default: Uses from_email if not specified
37
+ # reply_to_email=support@example.com
38
+
39
+ # Optional: Bounce handling email
40
+ # Description: Email address to receive bounce notifications
41
+ # bounce_email=bounce@example.com
42
+
43
+ # Optional: Return path email
44
+ # Description: Email address to use for return path
45
+ # return_path_email=returns@example.com
46
+
47
+ # SMTP Provider Configuration (placeholder - not yet implemented)
48
+ # Required when emailer_module=smtp
49
+ # Description: SMTP server hostname
50
+ # smtp_host=smtp.example.com
51
+
52
+ # Required when emailer_module=smtp
53
+ # Description: SMTP server port (typically 587 for TLS, 465 for SSL, 25 for non-secure)
54
+ # smtp_port=587
55
+
56
+ # Required when emailer_module=smtp
57
+ # Description: Use secure connection (true for SSL/TLS, false for non-secure)
58
+ # smtp_secure=false
59
+
60
+ # Required when emailer_module=smtp
61
+ # Description: SMTP authentication username (usually your email address)
62
+ # smtp_auth_user=your_email@example.com
63
+
64
+ # Required when emailer_module=smtp
65
+ # Description: SMTP authentication password or app-specific password
66
+ # smtp_auth_pass=your_password
67
+
68
+ # Optional: SMTP connection timeout in milliseconds
69
+ # Description: Timeout for SMTP connection attempts
70
+ # Default: 5000
71
+ # smtp_timeout=5000
72
+
73
+ # Optional: SMTP pool configuration
74
+ # Description: Enable connection pooling for better performance
75
+ # Default: false
76
+ # smtp_pool=false
77
+
78
+ # POP3 Provider Configuration (placeholder - not yet implemented)
79
+ # Required when emailer_module=pop3
80
+ # Description: POP3 server hostname
81
+ # pop3_host=pop3.example.com
82
+
83
+ # Required when emailer_module=pop3
84
+ # Description: POP3 server port (typically 995 for SSL, 110 for non-secure)
85
+ # pop3_port=995
86
+
87
+ # Required when emailer_module=pop3
88
+ # Description: Use secure connection (true for SSL, false for non-secure)
89
+ # pop3_secure=true
90
+
91
+ # Required when emailer_module=pop3
92
+ # Description: POP3 authentication username (usually your email address)
93
+ # pop3_auth_user=your_email@example.com
94
+
95
+ # Required when emailer_module=pop3
96
+ # Description: POP3 authentication password
97
+ # pop3_auth_pass=your_password
98
+
99
+ # Optional: POP3 connection timeout in milliseconds
100
+ # Description: Timeout for POP3 connection attempts
101
+ # Default: 5000
102
+ # pop3_timeout=5000
103
+
104
+ # Rate Limiting Configuration
105
+ # Optional: Rate limit requests per minute
106
+ # Description: Maximum number of requests allowed per minute per IP address
107
+ # Default: 10
108
+ # Recommended: 10-60 for production
109
+ # rate_limit_requests=10
110
+
111
+ # Optional: Rate limit window in seconds
112
+ # Description: Time window for rate limiting
113
+ # Default: 60 (1 minute)
114
+ # rate_limit_window=60
115
+
116
+ # Attachment Limits
117
+ # Optional: Maximum attachment size in bytes
118
+ # Description: Maximum size allowed per attachment (in bytes)
119
+ # Default: 10485760 (10MB)
120
+ # Recommended: 10MB for most use cases
121
+ # max_attachment_size=10485760
122
+
123
+ # Optional: Maximum number of attachments
124
+ # Description: Maximum number of attachments allowed per email
125
+ # Default: 10
126
+ # max_attachments=10
127
+
128
+ # Request Timeout
129
+ # Optional: Request timeout in milliseconds
130
+ # Description: Timeout for API requests to email providers
131
+ # Default: 30000 (30 seconds)
132
+ # request_timeout=30000
133
+
134
+ # Input Length Limits
135
+ # Optional: Maximum subject length in characters
136
+ # Description: Maximum length for email subject line
137
+ # Default: 255 (RFC 5322 standard)
138
+ # max_subject_length=255
139
+
140
+ # Optional: Maximum body length in bytes
141
+ # Description: Maximum size for email body content (text or HTML)
142
+ # Default: 1048576 (1MB)
143
+ # max_body_length=1048576
144
+
145
+ # CORS Configuration
146
+ # Optional: CORS allowed origins
147
+ # Description: Comma-separated list of allowed origins for CORS
148
+ # Default: empty (same-origin only)
149
+ # Use "*" to allow all origins (not recommended for production)
150
+ # cors_allowed_origins=
151
+
152
+ [ui]
153
+ # Enable UI component and all routes (e.g., /hazo_notify/emailer_test)
154
+ # Required: No
155
+ # Default: false
156
+ # Description: Enable the entire UI component and all routes for testing services
157
+ # Set to true to enable the UI, false to disable it
158
+ # enable_ui=false
159
+
@@ -0,0 +1,32 @@
1
+ // file_description: Next.js instrumentation file - runs once when server starts
2
+ // Initializes hazo_notify email service and passes it to hazo_auth email service
3
+ // section: instrumentation
4
+ export async function register() {
5
+ // Only run in server environment
6
+ if (typeof window === "undefined") {
7
+ try {
8
+ // Step 1: Import hazo_notify package
9
+ const hazo_notify_module = await import("hazo_notify");
10
+
11
+ // Step 2: Load hazo_notify emailer configuration
12
+ // This reads from hazo_notify_config.ini in the ui_component directory (same location as hazo_auth_config.ini)
13
+ const { load_emailer_config } = hazo_notify_module;
14
+ const notify_config = load_emailer_config();
15
+
16
+ // Step 3: Pass the initialized configuration to hazo_auth email service
17
+ // This allows the email service to reuse the same configuration instance
18
+ const { set_hazo_notify_instance } = await import("@/lib/services/email_service");
19
+ set_hazo_notify_instance(notify_config);
20
+
21
+ // Log successful initialization
22
+ console.log("hazo_notify initialized successfully");
23
+ } catch (error) {
24
+ // Log error but don't crash - allows app to run without email functionality
25
+ // The email service will attempt to load config on first use as fallback
26
+ const error_message = error instanceof Error ? error.message : "Unknown error";
27
+ console.warn("Failed to initialize hazo_notify:", error_message);
28
+ console.warn("Email service will attempt to load config on first use as fallback");
29
+ }
30
+ }
31
+ }
32
+