hazo_auth 1.0.3 → 1.0.5
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 +22 -1
- package/package.json +3 -3
- package/src/app/api/hazo_auth/auth/upload_profile_picture/route.ts +8 -8
- package/src/app/api/hazo_auth/change_password/route.ts +7 -7
- package/src/app/api/hazo_auth/forgot_password/route.ts +4 -4
- package/src/app/api/hazo_auth/get_auth/route.ts +4 -4
- package/src/app/api/hazo_auth/invalidate_cache/route.ts +5 -5
- package/src/app/api/hazo_auth/library_photos/route.ts +3 -3
- package/src/app/api/hazo_auth/login/route.ts +4 -4
- package/src/app/api/hazo_auth/logout/route.ts +4 -4
- package/src/app/api/hazo_auth/me/route.ts +1 -1
- package/src/app/api/hazo_auth/profile_picture/[filename]/route.ts +1 -1
- package/src/app/api/hazo_auth/register/route.ts +4 -4
- package/src/app/api/hazo_auth/remove_profile_picture/route.ts +5 -5
- package/src/app/api/hazo_auth/resend_verification/route.ts +4 -4
- package/src/app/api/hazo_auth/reset_password/route.ts +5 -5
- package/src/app/api/hazo_auth/update_user/route.ts +5 -5
- package/src/app/api/hazo_auth/upload_profile_picture/route.ts +8 -8
- package/src/app/api/hazo_auth/user_management/permissions/route.ts +4 -4
- package/src/app/api/hazo_auth/user_management/roles/route.ts +5 -5
- package/src/app/api/hazo_auth/user_management/users/roles/route.ts +5 -5
- package/src/app/api/hazo_auth/user_management/users/route.ts +6 -6
- package/src/app/api/hazo_auth/validate_reset_token/route.ts +4 -4
- package/src/app/api/hazo_auth/verify_email/route.ts +4 -4
- package/src/app/api/migrations/apply/route.ts +3 -3
- package/src/app/hazo_auth/forgot_password/forgot_password_page_client.tsx +4 -4
- package/src/app/hazo_auth/forgot_password/page.tsx +2 -2
- package/src/app/hazo_auth/login/login_page_client.tsx +5 -5
- package/src/app/hazo_auth/login/page.tsx +2 -2
- package/src/app/hazo_auth/my_settings/my_settings_page_client.tsx +3 -3
- package/src/app/hazo_auth/my_settings/page.tsx +2 -2
- package/src/app/hazo_auth/register/page.tsx +2 -2
- package/src/app/hazo_auth/register/register_page_client.tsx +4 -4
- package/src/app/hazo_auth/reset_password/page.tsx +2 -2
- package/src/app/hazo_auth/reset_password/reset_password_page_client.tsx +4 -4
- package/src/app/hazo_auth/user_management/page.tsx +1 -1
- package/src/app/hazo_auth/user_management/user_management_page_client.tsx +1 -1
- package/src/app/hazo_auth/verify_email/page.tsx +2 -2
- package/src/app/hazo_auth/verify_email/verify_email_page_client.tsx +4 -4
- package/src/app/hazo_connect/api/sqlite/data/route.ts +1 -1
- package/src/app/hazo_connect/api/sqlite/schema/route.ts +1 -1
- package/src/app/hazo_connect/api/sqlite/tables/route.ts +1 -1
- package/src/app/layout.tsx +1 -1
- package/src/app/page.tsx +1 -1
- package/src/components/layouts/email_verification/config/email_verification_field_config.ts +2 -2
- package/src/components/layouts/email_verification/hooks/use_email_verification.ts +3 -3
- package/src/components/layouts/email_verification/index.tsx +11 -11
- package/src/components/layouts/forgot_password/config/forgot_password_field_config.ts +2 -2
- package/src/components/layouts/forgot_password/hooks/use_forgot_password_form.ts +3 -3
- package/src/components/layouts/forgot_password/index.tsx +10 -10
- package/src/components/layouts/login/config/login_field_config.ts +2 -2
- package/src/components/layouts/login/hooks/use_login_form.ts +5 -5
- package/src/components/layouts/login/index.tsx +11 -11
- package/src/components/layouts/my_settings/components/editable_field.tsx +3 -3
- package/src/components/layouts/my_settings/components/password_change_dialog.tsx +5 -5
- package/src/components/layouts/my_settings/components/profile_picture_dialog.tsx +4 -4
- package/src/components/layouts/my_settings/components/profile_picture_display.tsx +2 -2
- package/src/components/layouts/my_settings/components/profile_picture_gravatar_tab.tsx +3 -3
- package/src/components/layouts/my_settings/components/profile_picture_library_tab.tsx +5 -5
- package/src/components/layouts/my_settings/components/profile_picture_upload_tab.tsx +4 -4
- package/src/components/layouts/my_settings/config/my_settings_field_config.ts +2 -2
- package/src/components/layouts/my_settings/hooks/use_my_settings.ts +2 -2
- package/src/components/layouts/my_settings/index.tsx +5 -5
- package/src/components/layouts/register/config/register_field_config.ts +2 -2
- package/src/components/layouts/register/hooks/use_register_form.ts +4 -4
- package/src/components/layouts/register/index.tsx +11 -11
- package/src/components/layouts/reset_password/config/reset_password_field_config.ts +2 -2
- package/src/components/layouts/reset_password/hooks/use_reset_password_form.ts +4 -4
- package/src/components/layouts/reset_password/index.tsx +10 -10
- package/src/components/layouts/shared/components/already_logged_in_guard.tsx +4 -4
- package/src/components/layouts/shared/components/form_action_buttons.tsx +2 -2
- package/src/components/layouts/shared/components/form_field_wrapper.tsx +2 -2
- package/src/components/layouts/shared/components/logout_button.tsx +2 -2
- package/src/components/layouts/shared/components/password_field.tsx +3 -3
- package/src/components/layouts/shared/components/profile_pic_menu.tsx +5 -5
- package/src/components/layouts/shared/components/profile_pic_menu_wrapper.tsx +1 -1
- package/src/components/layouts/shared/components/sidebar_layout_wrapper.tsx +3 -3
- package/src/components/layouts/shared/components/two_column_auth_layout.tsx +1 -1
- package/src/components/layouts/shared/components/unauthorized_guard.tsx +2 -2
- package/src/components/layouts/shared/hooks/use_hazo_auth.ts +1 -1
- package/src/components/layouts/shared/utils/validation.ts +1 -1
- package/src/components/layouts/user_management/components/roles_matrix.tsx +7 -7
- package/src/components/layouts/user_management/index.tsx +10 -10
- package/src/components/ui/alert-dialog.tsx +2 -2
- package/src/components/ui/avatar.tsx +1 -1
- package/src/components/ui/button.tsx +1 -1
- package/src/components/ui/checkbox.tsx +1 -1
- package/src/components/ui/dialog.tsx +1 -1
- package/src/components/ui/dropdown-menu.tsx +1 -1
- package/src/components/ui/hazo_ui_tooltip.tsx +1 -1
- package/src/components/ui/input.tsx +1 -1
- package/src/components/ui/label.tsx +1 -1
- package/src/components/ui/separator.tsx +1 -1
- package/src/components/ui/sheet.tsx +1 -1
- package/src/components/ui/sidebar.tsx +8 -8
- package/src/components/ui/skeleton.tsx +1 -1
- package/src/components/ui/switch.tsx +1 -1
- package/src/components/ui/table.tsx +1 -1
- package/src/components/ui/tabs.tsx +1 -1
- package/src/components/ui/tooltip.tsx +1 -1
- package/src/components/ui/vertical-tabs.tsx +1 -1
- package/src/lib/app_logger.ts +1 -1
- package/src/lib/hazo_connect_setup.server.ts +2 -2
- package/src/stories/email_verification_layout.stories.tsx +2 -2
- package/src/stories/forgot_password_layout.stories.tsx +2 -2
- package/src/stories/login_layout.stories.tsx +2 -2
- package/src/stories/register_layout.stories.tsx +2 -2
- package/tsconfig.json +1 -4
package/README.md
CHANGED
|
@@ -27,7 +27,28 @@ After installing the package, you need to set up configuration files in your pro
|
|
|
27
27
|
- Add `ZEPTOMAIL_API_KEY=your_api_key_here` (if using Zeptomail)
|
|
28
28
|
- Add other sensitive configuration values as needed
|
|
29
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.
|
|
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, so storing them elsewhere (including `node_modules/hazo_auth`) will break runtime access.
|
|
31
|
+
|
|
32
|
+
### Expose hazo_auth Routes in the Consumer App
|
|
33
|
+
|
|
34
|
+
Because `src/app/hazo_auth` (pages) and `src/app/api/hazo_auth` (API routes) need to be part of the consuming Next.js app’s routing tree, make sure they exist in your project’s `src/app` directory. Two recommended approaches:
|
|
35
|
+
|
|
36
|
+
1. **Create symlinks (preferred during development):**
|
|
37
|
+
```bash
|
|
38
|
+
mkdir -p src/app/api src/app
|
|
39
|
+
ln -s ../../node_modules/hazo_auth/src/app/api/hazo_auth src/app/api/hazo_auth
|
|
40
|
+
ln -s ../../node_modules/hazo_auth/src/app/hazo_auth src/app/hazo_auth
|
|
41
|
+
```
|
|
42
|
+
Adjust the relative paths if your project structure differs.
|
|
43
|
+
|
|
44
|
+
2. **Copy the directories (useful for deployment or when symlinks cause issues):**
|
|
45
|
+
```bash
|
|
46
|
+
cp -R node_modules/hazo_auth/src/app/api/hazo_auth src/app/api/hazo_auth
|
|
47
|
+
cp -R node_modules/hazo_auth/src/app/hazo_auth src/app/hazo_auth
|
|
48
|
+
```
|
|
49
|
+
Add an npm script (e.g., `postinstall`) to automate copying after installations or updates.
|
|
50
|
+
|
|
51
|
+
> The package expects these routes to live at `src/app/api/hazo_auth` and `src/app/hazo_auth` inside the consumer project. Without copying or linking them, Next.js won’t mount the auth pages or APIs.
|
|
31
52
|
|
|
32
53
|
## Authentication Service
|
|
33
54
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hazo_auth",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"files": [
|
|
5
5
|
"src/**/*",
|
|
6
6
|
"public/file.svg",
|
|
@@ -101,8 +101,8 @@
|
|
|
101
101
|
"@types/react-dom": "^18",
|
|
102
102
|
"better-sqlite3": "^12.4.1",
|
|
103
103
|
"cross-env": "^10.1.0",
|
|
104
|
-
"eslint": "^
|
|
105
|
-
"eslint-config-next": "^
|
|
104
|
+
"eslint": "^8.57.0",
|
|
105
|
+
"eslint-config-next": "^14.2.7",
|
|
106
106
|
"eslint-plugin-storybook": "^10.0.6",
|
|
107
107
|
"jest": "^30.2.0",
|
|
108
108
|
"jest-environment-jsdom": "^29.7.0",
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// file_description: API route for uploading profile pictures
|
|
2
2
|
// section: imports
|
|
3
3
|
import { NextRequest, NextResponse } from "next/server";
|
|
4
|
-
import { get_hazo_connect_instance } from "
|
|
5
|
-
import { create_app_logger } from "
|
|
6
|
-
import { get_profile_picture_config } from "
|
|
7
|
-
import { get_file_types_config } from "
|
|
8
|
-
import { update_user_profile_picture } from "
|
|
4
|
+
import { get_hazo_connect_instance } from "../../../../../lib/hazo_connect_instance.server";
|
|
5
|
+
import { create_app_logger } from "../../../../../lib/app_logger";
|
|
6
|
+
import { get_profile_picture_config } from "../../../../../lib/profile_picture_config.server";
|
|
7
|
+
import { get_file_types_config } from "../../../../../lib/file_types_config.server";
|
|
8
|
+
import { update_user_profile_picture } from "../../../../../lib/services/profile_picture_service";
|
|
9
9
|
import { createCrudService } from "hazo_connect/server";
|
|
10
|
-
import { map_db_source_to_ui } from "
|
|
11
|
-
import { get_filename, get_line_number } from "
|
|
10
|
+
import { map_db_source_to_ui } from "../../../../../lib/services/profile_picture_source_mapper";
|
|
11
|
+
import { get_filename, get_line_number } from "../../../../../lib/utils/api_route_helpers";
|
|
12
12
|
import fs from "fs";
|
|
13
13
|
import path from "path";
|
|
14
14
|
|
|
@@ -20,7 +20,7 @@ export async function POST(request: NextRequest) {
|
|
|
20
20
|
// Use centralized auth check
|
|
21
21
|
let user_id: string;
|
|
22
22
|
try {
|
|
23
|
-
const { require_auth } = await import("
|
|
23
|
+
const { require_auth } = await import("../../../../../lib/auth/auth_utils.server");
|
|
24
24
|
const user = await require_auth(request);
|
|
25
25
|
user_id = user.user_id;
|
|
26
26
|
} catch (error) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// file_description: API route for changing user password
|
|
2
2
|
// section: imports
|
|
3
3
|
import { NextRequest, NextResponse } from "next/server";
|
|
4
|
-
import { get_hazo_connect_instance } from "
|
|
5
|
-
import { create_app_logger } from "
|
|
6
|
-
import { change_password } from "
|
|
7
|
-
import { get_filename, get_line_number } from "
|
|
8
|
-
import { require_auth } from "
|
|
9
|
-
import { get_auth_cache } from "
|
|
10
|
-
import { get_auth_utility_config } from "
|
|
4
|
+
import { get_hazo_connect_instance } from "../../../../lib/hazo_connect_instance.server";
|
|
5
|
+
import { create_app_logger } from "../../../../lib/app_logger";
|
|
6
|
+
import { change_password } from "../../../../lib/services/password_change_service";
|
|
7
|
+
import { get_filename, get_line_number } from "../../../../lib/utils/api_route_helpers";
|
|
8
|
+
import { require_auth } from "../../../../lib/auth/auth_utils.server";
|
|
9
|
+
import { get_auth_cache } from "../../../../lib/auth/auth_cache";
|
|
10
|
+
import { get_auth_utility_config } from "../../../../lib/auth_utility_config.server";
|
|
11
11
|
|
|
12
12
|
// section: api_handler
|
|
13
13
|
export async function POST(request: NextRequest) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// file_description: API route for password reset requests using hazo_connect
|
|
2
2
|
// section: imports
|
|
3
3
|
import { NextRequest, NextResponse } from "next/server";
|
|
4
|
-
import { get_hazo_connect_instance } from "
|
|
5
|
-
import { create_app_logger } from "
|
|
6
|
-
import { request_password_reset } from "
|
|
7
|
-
import { get_filename, get_line_number } from "
|
|
4
|
+
import { get_hazo_connect_instance } from "../../../../lib/hazo_connect_instance.server";
|
|
5
|
+
import { create_app_logger } from "../../../../lib/app_logger";
|
|
6
|
+
import { request_password_reset } from "../../../../lib/services/password_reset_service";
|
|
7
|
+
import { get_filename, get_line_number } from "../../../../lib/utils/api_route_helpers";
|
|
8
8
|
|
|
9
9
|
// section: api_handler
|
|
10
10
|
export async function POST(request: NextRequest) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// file_description: API route for hazo_get_auth utility (client-side calls)
|
|
2
2
|
// section: imports
|
|
3
3
|
import { NextRequest, NextResponse } from "next/server";
|
|
4
|
-
import { hazo_get_auth } from "
|
|
5
|
-
import { PermissionError } from "
|
|
6
|
-
import { create_app_logger } from "
|
|
7
|
-
import { get_filename, get_line_number } from "
|
|
4
|
+
import { hazo_get_auth } from "../../../../lib/auth/hazo_get_auth.server";
|
|
5
|
+
import { PermissionError } from "../../../../lib/auth/auth_types";
|
|
6
|
+
import { create_app_logger } from "../../../../lib/app_logger";
|
|
7
|
+
import { get_filename, get_line_number } from "../../../../lib/utils/api_route_helpers";
|
|
8
8
|
|
|
9
9
|
// section: route_config
|
|
10
10
|
export const dynamic = "force-dynamic";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// file_description: API route for manual cache invalidation (admin endpoint)
|
|
2
2
|
// section: imports
|
|
3
3
|
import { NextRequest, NextResponse } from "next/server";
|
|
4
|
-
import { get_auth_cache } from "
|
|
5
|
-
import { get_auth_utility_config } from "
|
|
6
|
-
import { create_app_logger } from "
|
|
7
|
-
import { get_filename, get_line_number } from "
|
|
8
|
-
import { hazo_get_auth } from "
|
|
4
|
+
import { get_auth_cache } from "../../../../lib/auth/auth_cache";
|
|
5
|
+
import { get_auth_utility_config } from "../../../../lib/auth_utility_config.server";
|
|
6
|
+
import { create_app_logger } from "../../../../lib/app_logger";
|
|
7
|
+
import { get_filename, get_line_number } from "../../../../lib/utils/api_route_helpers";
|
|
8
|
+
import { hazo_get_auth } from "../../../../lib/auth/hazo_get_auth.server";
|
|
9
9
|
|
|
10
10
|
// section: route_config
|
|
11
11
|
export const dynamic = "force-dynamic";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// file_description: API route for listing library photo categories and photos in categories
|
|
2
2
|
// section: imports
|
|
3
3
|
import { NextRequest, NextResponse } from "next/server";
|
|
4
|
-
import { get_library_categories, get_library_photos } from "
|
|
5
|
-
import { create_app_logger } from "
|
|
6
|
-
import { get_filename, get_line_number } from "
|
|
4
|
+
import { get_library_categories, get_library_photos } from "../../../../lib/services/profile_picture_service";
|
|
5
|
+
import { create_app_logger } from "../../../../lib/app_logger";
|
|
6
|
+
import { get_filename, get_line_number } from "../../../../lib/utils/api_route_helpers";
|
|
7
7
|
|
|
8
8
|
// section: route_config
|
|
9
9
|
export const dynamic = 'force-dynamic';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// file_description: API route for user login authentication using hazo_connect
|
|
2
2
|
// section: imports
|
|
3
3
|
import { NextRequest, NextResponse } from "next/server";
|
|
4
|
-
import { get_hazo_connect_instance } from "
|
|
5
|
-
import { create_app_logger } from "
|
|
6
|
-
import { authenticate_user } from "
|
|
4
|
+
import { get_hazo_connect_instance } from "../../../../lib/hazo_connect_instance.server";
|
|
5
|
+
import { create_app_logger } from "../../../../lib/app_logger";
|
|
6
|
+
import { authenticate_user } from "../../../../lib/services/login_service";
|
|
7
7
|
import { createCrudService } from "hazo_connect/server";
|
|
8
|
-
import { get_filename, get_line_number } from "
|
|
8
|
+
import { get_filename, get_line_number } from "../../../../lib/utils/api_route_helpers";
|
|
9
9
|
|
|
10
10
|
// section: api_handler
|
|
11
11
|
export async function POST(request: NextRequest) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// file_description: API route for user logout
|
|
2
2
|
// section: imports
|
|
3
3
|
import { NextRequest, NextResponse } from "next/server";
|
|
4
|
-
import { create_app_logger } from "
|
|
5
|
-
import { get_filename, get_line_number } from "
|
|
6
|
-
import { get_auth_cache } from "
|
|
7
|
-
import { get_auth_utility_config } from "
|
|
4
|
+
import { create_app_logger } from "../../../../lib/app_logger";
|
|
5
|
+
import { get_filename, get_line_number } from "../../../../lib/utils/api_route_helpers";
|
|
6
|
+
import { get_auth_cache } from "../../../../lib/auth/auth_cache";
|
|
7
|
+
import { get_auth_utility_config } from "../../../../lib/auth_utility_config.server";
|
|
8
8
|
|
|
9
9
|
// section: api_handler
|
|
10
10
|
export async function POST(request: NextRequest) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// file_description: API route to get current authenticated user information
|
|
2
2
|
// section: imports
|
|
3
3
|
import { NextRequest, NextResponse } from "next/server";
|
|
4
|
-
import { get_authenticated_user_with_response } from "
|
|
4
|
+
import { get_authenticated_user_with_response } from "../../../../lib/auth/auth_utils.server";
|
|
5
5
|
|
|
6
6
|
// section: api_handler
|
|
7
7
|
export async function GET(request: NextRequest) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// file_description: API route to serve uploaded profile pictures
|
|
2
2
|
// section: imports
|
|
3
3
|
import { NextRequest, NextResponse } from "next/server";
|
|
4
|
-
import { get_profile_picture_config } from "
|
|
4
|
+
import { get_profile_picture_config } from "../../../../../lib/profile_picture_config.server";
|
|
5
5
|
import fs from "fs";
|
|
6
6
|
import path from "path";
|
|
7
7
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// file_description: API route for user registration using hazo_connect to insert into hazo_users table
|
|
2
2
|
// section: imports
|
|
3
3
|
import { NextRequest, NextResponse } from "next/server";
|
|
4
|
-
import { get_hazo_connect_instance } from "
|
|
5
|
-
import { create_app_logger } from "
|
|
6
|
-
import { register_user } from "
|
|
7
|
-
import { get_filename, get_line_number } from "
|
|
4
|
+
import { get_hazo_connect_instance } from "../../../../lib/hazo_connect_instance.server";
|
|
5
|
+
import { create_app_logger } from "../../../../lib/app_logger";
|
|
6
|
+
import { register_user } from "../../../../lib/services/registration_service";
|
|
7
|
+
import { get_filename, get_line_number } from "../../../../lib/utils/api_route_helpers";
|
|
8
8
|
|
|
9
9
|
// section: api_handler
|
|
10
10
|
export async function POST(request: NextRequest) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// file_description: API route for removing profile pictures
|
|
2
2
|
// section: imports
|
|
3
3
|
import { NextRequest, NextResponse } from "next/server";
|
|
4
|
-
import { get_hazo_connect_instance } from "
|
|
5
|
-
import { create_app_logger } from "
|
|
6
|
-
import { remove_user_profile_picture } from "
|
|
7
|
-
import { get_filename, get_line_number } from "
|
|
4
|
+
import { get_hazo_connect_instance } from "../../../../lib/hazo_connect_instance.server";
|
|
5
|
+
import { create_app_logger } from "../../../../lib/app_logger";
|
|
6
|
+
import { remove_user_profile_picture } from "../../../../lib/services/profile_picture_remove_service";
|
|
7
|
+
import { get_filename, get_line_number } from "../../../../lib/utils/api_route_helpers";
|
|
8
8
|
|
|
9
9
|
// section: api_handler
|
|
10
10
|
export async function DELETE(request: NextRequest) {
|
|
@@ -14,7 +14,7 @@ export async function DELETE(request: NextRequest) {
|
|
|
14
14
|
// Use centralized auth check
|
|
15
15
|
let user_id: string;
|
|
16
16
|
try {
|
|
17
|
-
const { require_auth } = await import("
|
|
17
|
+
const { require_auth } = await import("../../../../lib/auth/auth_utils.server");
|
|
18
18
|
const user = await require_auth(request);
|
|
19
19
|
user_id = user.user_id;
|
|
20
20
|
} catch (error) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// file_description: API route for resending email verification using hazo_connect
|
|
2
2
|
// section: imports
|
|
3
3
|
import { NextRequest, NextResponse } from "next/server";
|
|
4
|
-
import { get_hazo_connect_instance } from "
|
|
5
|
-
import { create_app_logger } from "
|
|
6
|
-
import { resend_verification_email } from "
|
|
7
|
-
import { get_filename, get_line_number } from "
|
|
4
|
+
import { get_hazo_connect_instance } from "../../../../lib/hazo_connect_instance.server";
|
|
5
|
+
import { create_app_logger } from "../../../../lib/app_logger";
|
|
6
|
+
import { resend_verification_email } from "../../../../lib/services/email_verification_service";
|
|
7
|
+
import { get_filename, get_line_number } from "../../../../lib/utils/api_route_helpers";
|
|
8
8
|
|
|
9
9
|
// section: api_handler
|
|
10
10
|
export async function POST(request: NextRequest) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// file_description: API route for resetting user password using a reset token
|
|
2
2
|
// section: imports
|
|
3
3
|
import { NextRequest, NextResponse } from "next/server";
|
|
4
|
-
import { get_hazo_connect_instance } from "
|
|
5
|
-
import { reset_password } from "
|
|
6
|
-
import { create_app_logger } from "
|
|
7
|
-
import { get_password_requirements_config } from "
|
|
8
|
-
import { get_filename, get_line_number } from "
|
|
4
|
+
import { get_hazo_connect_instance } from "../../../../lib/hazo_connect_instance.server";
|
|
5
|
+
import { reset_password } from "../../../../lib/services/password_reset_service";
|
|
6
|
+
import { create_app_logger } from "../../../../lib/app_logger";
|
|
7
|
+
import { get_password_requirements_config } from "../../../../lib/password_requirements_config.server";
|
|
8
|
+
import { get_filename, get_line_number } from "../../../../lib/utils/api_route_helpers";
|
|
9
9
|
|
|
10
10
|
// section: api_handler
|
|
11
11
|
export async function POST(request: NextRequest) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// file_description: API route for updating user profile information
|
|
2
2
|
// section: imports
|
|
3
3
|
import { NextRequest, NextResponse } from "next/server";
|
|
4
|
-
import { get_hazo_connect_instance } from "
|
|
5
|
-
import { create_app_logger } from "
|
|
6
|
-
import { update_user_profile } from "
|
|
7
|
-
import { get_filename, get_line_number } from "
|
|
8
|
-
import { require_auth } from "
|
|
4
|
+
import { get_hazo_connect_instance } from "../../../../lib/hazo_connect_instance.server";
|
|
5
|
+
import { create_app_logger } from "../../../../lib/app_logger";
|
|
6
|
+
import { update_user_profile } from "../../../../lib/services/user_update_service";
|
|
7
|
+
import { get_filename, get_line_number } from "../../../../lib/utils/api_route_helpers";
|
|
8
|
+
import { require_auth } from "../../../../lib/auth/auth_utils.server";
|
|
9
9
|
|
|
10
10
|
// section: api_handler
|
|
11
11
|
export async function PATCH(request: NextRequest) {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// file_description: API route for uploading profile pictures
|
|
2
2
|
// section: imports
|
|
3
3
|
import { NextRequest, NextResponse } from "next/server";
|
|
4
|
-
import { get_hazo_connect_instance } from "
|
|
5
|
-
import { create_app_logger } from "
|
|
6
|
-
import { get_profile_picture_config } from "
|
|
7
|
-
import { get_file_types_config } from "
|
|
8
|
-
import { update_user_profile_picture } from "
|
|
4
|
+
import { get_hazo_connect_instance } from "../../../../lib/hazo_connect_instance.server";
|
|
5
|
+
import { create_app_logger } from "../../../../lib/app_logger";
|
|
6
|
+
import { get_profile_picture_config } from "../../../../lib/profile_picture_config.server";
|
|
7
|
+
import { get_file_types_config } from "../../../../lib/file_types_config.server";
|
|
8
|
+
import { update_user_profile_picture } from "../../../../lib/services/profile_picture_service";
|
|
9
9
|
import { createCrudService } from "hazo_connect/server";
|
|
10
|
-
import { map_db_source_to_ui } from "
|
|
11
|
-
import { get_filename, get_line_number } from "
|
|
10
|
+
import { map_db_source_to_ui } from "../../../../lib/services/profile_picture_source_mapper";
|
|
11
|
+
import { get_filename, get_line_number } from "../../../../lib/utils/api_route_helpers";
|
|
12
12
|
import fs from "fs";
|
|
13
13
|
import path from "path";
|
|
14
14
|
|
|
@@ -20,7 +20,7 @@ export async function POST(request: NextRequest) {
|
|
|
20
20
|
// Use centralized auth check
|
|
21
21
|
let user_id: string;
|
|
22
22
|
try {
|
|
23
|
-
const { require_auth } = await import("
|
|
23
|
+
const { require_auth } = await import("../../../../lib/auth/auth_utils.server");
|
|
24
24
|
const user = await require_auth(request);
|
|
25
25
|
user_id = user.user_id;
|
|
26
26
|
} catch (error) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// file_description: API route for permissions management operations (list, migrate from config, update, delete)
|
|
2
2
|
// section: imports
|
|
3
3
|
import { NextRequest, NextResponse } from "next/server";
|
|
4
|
-
import { get_hazo_connect_instance } from "
|
|
4
|
+
import { get_hazo_connect_instance } from "../../../../../lib/hazo_connect_instance.server";
|
|
5
5
|
import { createCrudService } from "hazo_connect/server";
|
|
6
|
-
import { create_app_logger } from "
|
|
7
|
-
import { get_filename, get_line_number } from "
|
|
8
|
-
import { get_user_management_config } from "
|
|
6
|
+
import { create_app_logger } from "../../../../../lib/app_logger";
|
|
7
|
+
import { get_filename, get_line_number } from "../../../../../lib/utils/api_route_helpers";
|
|
8
|
+
import { get_user_management_config } from "../../../../../lib/user_management_config.server";
|
|
9
9
|
|
|
10
10
|
// section: route_config
|
|
11
11
|
export const dynamic = 'force-dynamic';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// file_description: API route for roles management operations (list roles with permissions, create role, update role permissions)
|
|
2
2
|
// section: imports
|
|
3
3
|
import { NextRequest, NextResponse } from "next/server";
|
|
4
|
-
import { get_hazo_connect_instance } from "
|
|
4
|
+
import { get_hazo_connect_instance } from "../../../../../lib/hazo_connect_instance.server";
|
|
5
5
|
import { createCrudService, getSqliteAdminService } from "hazo_connect/server";
|
|
6
|
-
import { create_app_logger } from "
|
|
7
|
-
import { get_filename, get_line_number } from "
|
|
8
|
-
import { get_auth_cache } from "
|
|
9
|
-
import { get_auth_utility_config } from "
|
|
6
|
+
import { create_app_logger } from "../../../../../lib/app_logger";
|
|
7
|
+
import { get_filename, get_line_number } from "../../../../../lib/utils/api_route_helpers";
|
|
8
|
+
import { get_auth_cache } from "../../../../../lib/auth/auth_cache";
|
|
9
|
+
import { get_auth_utility_config } from "../../../../../lib/auth_utility_config.server";
|
|
10
10
|
|
|
11
11
|
// section: route_config
|
|
12
12
|
export const dynamic = 'force-dynamic';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// file_description: API route for managing user roles (assigning roles to users)
|
|
2
2
|
// section: imports
|
|
3
3
|
import { NextRequest, NextResponse } from "next/server";
|
|
4
|
-
import { get_hazo_connect_instance } from "
|
|
4
|
+
import { get_hazo_connect_instance } from "../../../../../../lib/hazo_connect_instance.server";
|
|
5
5
|
import { createCrudService, getSqliteAdminService } from "hazo_connect/server";
|
|
6
|
-
import { create_app_logger } from "
|
|
7
|
-
import { get_filename, get_line_number } from "
|
|
8
|
-
import { get_auth_cache } from "
|
|
9
|
-
import { get_auth_utility_config } from "
|
|
6
|
+
import { create_app_logger } from "../../../../../../lib/app_logger";
|
|
7
|
+
import { get_filename, get_line_number } from "../../../../../../lib/utils/api_route_helpers";
|
|
8
|
+
import { get_auth_cache } from "../../../../../../lib/auth/auth_cache";
|
|
9
|
+
import { get_auth_utility_config } from "../../../../../../lib/auth_utility_config.server";
|
|
10
10
|
|
|
11
11
|
// section: route_config
|
|
12
12
|
export const dynamic = 'force-dynamic';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// file_description: API route for user management operations (list users, deactivate, reset password)
|
|
2
2
|
// section: imports
|
|
3
3
|
import { NextRequest, NextResponse } from "next/server";
|
|
4
|
-
import { get_hazo_connect_instance } from "
|
|
4
|
+
import { get_hazo_connect_instance } from "../../../../../lib/hazo_connect_instance.server";
|
|
5
5
|
import { createCrudService } from "hazo_connect/server";
|
|
6
|
-
import { create_app_logger } from "
|
|
7
|
-
import { get_filename, get_line_number } from "
|
|
8
|
-
import { request_password_reset } from "
|
|
9
|
-
import { get_auth_cache } from "
|
|
10
|
-
import { get_auth_utility_config } from "
|
|
6
|
+
import { create_app_logger } from "../../../../../lib/app_logger";
|
|
7
|
+
import { get_filename, get_line_number } from "../../../../../lib/utils/api_route_helpers";
|
|
8
|
+
import { request_password_reset } from "../../../../../lib/services/password_reset_service";
|
|
9
|
+
import { get_auth_cache } from "../../../../../lib/auth/auth_cache";
|
|
10
|
+
import { get_auth_utility_config } from "../../../../../lib/auth_utility_config.server";
|
|
11
11
|
|
|
12
12
|
// section: route_config
|
|
13
13
|
export const dynamic = 'force-dynamic';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// file_description: API route for validating password reset token without resetting password
|
|
2
2
|
// section: imports
|
|
3
3
|
import { NextRequest, NextResponse } from "next/server";
|
|
4
|
-
import { get_hazo_connect_instance } from "
|
|
5
|
-
import { validate_password_reset_token } from "
|
|
6
|
-
import { create_app_logger } from "
|
|
7
|
-
import { get_filename, get_line_number } from "
|
|
4
|
+
import { get_hazo_connect_instance } from "../../../../lib/hazo_connect_instance.server";
|
|
5
|
+
import { validate_password_reset_token } from "../../../../lib/services/password_reset_service";
|
|
6
|
+
import { create_app_logger } from "../../../../lib/app_logger";
|
|
7
|
+
import { get_filename, get_line_number } from "../../../../lib/utils/api_route_helpers";
|
|
8
8
|
|
|
9
9
|
// section: route_config
|
|
10
10
|
export const dynamic = 'force-dynamic';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// file_description: API route for email verification using hazo_connect
|
|
2
2
|
// section: imports
|
|
3
3
|
import { NextRequest, NextResponse } from "next/server";
|
|
4
|
-
import { get_hazo_connect_instance } from "
|
|
5
|
-
import { create_app_logger } from "
|
|
6
|
-
import { verify_email_token } from "
|
|
7
|
-
import { get_filename, get_line_number } from "
|
|
4
|
+
import { get_hazo_connect_instance } from "../../../../lib/hazo_connect_instance.server";
|
|
5
|
+
import { create_app_logger } from "../../../../lib/app_logger";
|
|
6
|
+
import { verify_email_token } from "../../../../lib/services/email_verification_service";
|
|
7
|
+
import { get_filename, get_line_number } from "../../../../lib/utils/api_route_helpers";
|
|
8
8
|
|
|
9
9
|
// section: route_config
|
|
10
10
|
export const dynamic = 'force-dynamic';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// file_description: API route to manually apply database migrations
|
|
2
2
|
// section: imports
|
|
3
3
|
import { NextRequest, NextResponse } from "next/server";
|
|
4
|
-
import { get_hazo_connect_instance } from "
|
|
5
|
-
import { create_app_logger } from "
|
|
4
|
+
import { get_hazo_connect_instance } from "../../../../lib/hazo_connect_instance.server";
|
|
5
|
+
import { create_app_logger } from "../../../../lib/app_logger";
|
|
6
6
|
import fs from "fs";
|
|
7
7
|
import path from "path";
|
|
8
|
-
import { get_filename, get_line_number } from "
|
|
8
|
+
import { get_filename, get_line_number } from "../../../../lib/utils/api_route_helpers";
|
|
9
9
|
|
|
10
10
|
// section: api_handler
|
|
11
11
|
export async function POST(request: NextRequest) {
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
// section: imports
|
|
6
6
|
import { useEffect, useState } from "react";
|
|
7
|
-
import forgot_password_layout from "
|
|
8
|
-
import { createLayoutDataClient } from "
|
|
9
|
-
import { create_sqlite_hazo_connect } from "
|
|
10
|
-
import type { LayoutDataClient } from "
|
|
7
|
+
import forgot_password_layout from "../../../components/layouts/forgot_password";
|
|
8
|
+
import { createLayoutDataClient } from "../../../components/layouts/shared/data/layout_data_client";
|
|
9
|
+
import { create_sqlite_hazo_connect } from "../../../lib/hazo_connect_setup";
|
|
10
|
+
import type { LayoutDataClient } from "../../../components/layouts/shared/data/layout_data_client";
|
|
11
11
|
|
|
12
12
|
// section: types
|
|
13
13
|
type ForgotPasswordPageClientProps = {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// file_description: render the forgot password page shell and mount the forgot password layout component within sidebar
|
|
2
2
|
// section: imports
|
|
3
|
-
import { SidebarLayoutWrapper } from "
|
|
3
|
+
import { SidebarLayoutWrapper } from "../../../components/layouts/shared/components/sidebar_layout_wrapper";
|
|
4
4
|
import { ForgotPasswordPageClient } from "./forgot_password_page_client";
|
|
5
|
-
import { get_forgot_password_config } from "
|
|
5
|
+
import { get_forgot_password_config } from "../../../lib/forgot_password_config.server";
|
|
6
6
|
|
|
7
7
|
// section: component
|
|
8
8
|
export default function forgot_password_page() {
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
// section: imports
|
|
6
6
|
import { useEffect, useState } from "react";
|
|
7
|
-
import login_layout from "
|
|
8
|
-
import { createLayoutDataClient } from "
|
|
9
|
-
import { create_sqlite_hazo_connect } from "
|
|
10
|
-
import { create_app_logger } from "
|
|
11
|
-
import type { LayoutDataClient } from "
|
|
7
|
+
import login_layout from "../../../components/layouts/login";
|
|
8
|
+
import { createLayoutDataClient } from "../../../components/layouts/shared/data/layout_data_client";
|
|
9
|
+
import { create_sqlite_hazo_connect } from "../../../lib/hazo_connect_setup";
|
|
10
|
+
import { create_app_logger } from "../../../lib/app_logger";
|
|
11
|
+
import type { LayoutDataClient } from "../../../components/layouts/shared/data/layout_data_client";
|
|
12
12
|
|
|
13
13
|
// section: types
|
|
14
14
|
type LoginPageClientProps = {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// file_description: render the login page shell and mount the login layout component within sidebar
|
|
2
2
|
// section: imports
|
|
3
|
-
import { SidebarLayoutWrapper } from "
|
|
3
|
+
import { SidebarLayoutWrapper } from "../../../components/layouts/shared/components/sidebar_layout_wrapper";
|
|
4
4
|
import { LoginPageClient } from "./login_page_client";
|
|
5
|
-
import { get_login_config } from "
|
|
5
|
+
import { get_login_config } from "../../../lib/login_config.server";
|
|
6
6
|
|
|
7
7
|
// section: component
|
|
8
8
|
export default function login_page() {
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
// section: imports
|
|
6
6
|
import { useEffect, useState } from "react";
|
|
7
|
-
import my_settings_layout from "
|
|
8
|
-
import type { LayoutDataClient } from "
|
|
9
|
-
import type { PasswordRequirementOptions } from "
|
|
7
|
+
import my_settings_layout from "../../../components/layouts/my_settings";
|
|
8
|
+
import type { LayoutDataClient } from "../../../components/layouts/shared/data/layout_data_client";
|
|
9
|
+
import type { PasswordRequirementOptions } from "../../../components/layouts/shared/config/layout_customization";
|
|
10
10
|
|
|
11
11
|
// section: types
|
|
12
12
|
type MySettingsPageClientProps = {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// file_description: render the my settings page shell and mount the my settings layout component within sidebar
|
|
2
2
|
// section: imports
|
|
3
|
-
import { SidebarLayoutWrapper } from "
|
|
3
|
+
import { SidebarLayoutWrapper } from "../../../components/layouts/shared/components/sidebar_layout_wrapper";
|
|
4
4
|
import { MySettingsPageClient } from "./my_settings_page_client";
|
|
5
|
-
import { get_my_settings_config } from "
|
|
5
|
+
import { get_my_settings_config } from "../../../lib/my_settings_config.server";
|
|
6
6
|
|
|
7
7
|
// section: component
|
|
8
8
|
export default function my_settings_page() {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// file_description: render the register page shell and mount the register layout component within sidebar
|
|
2
2
|
// section: imports
|
|
3
|
-
import { SidebarLayoutWrapper } from "
|
|
3
|
+
import { SidebarLayoutWrapper } from "../../../components/layouts/shared/components/sidebar_layout_wrapper";
|
|
4
4
|
import { RegisterPageClient } from "./register_page_client";
|
|
5
|
-
import { get_register_config } from "
|
|
5
|
+
import { get_register_config } from "../../../lib/register_config.server";
|
|
6
6
|
|
|
7
7
|
// section: component
|
|
8
8
|
export default function register_page() {
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
// section: imports
|
|
6
6
|
import { useEffect, useState } from "react";
|
|
7
|
-
import register_layout from "
|
|
8
|
-
import { createLayoutDataClient } from "
|
|
9
|
-
import { create_sqlite_hazo_connect } from "
|
|
10
|
-
import type { LayoutDataClient } from "
|
|
7
|
+
import register_layout from "../../../components/layouts/register";
|
|
8
|
+
import { createLayoutDataClient } from "../../../components/layouts/shared/data/layout_data_client";
|
|
9
|
+
import { create_sqlite_hazo_connect } from "../../../lib/hazo_connect_setup";
|
|
10
|
+
import type { LayoutDataClient } from "../../../components/layouts/shared/data/layout_data_client";
|
|
11
11
|
|
|
12
12
|
// section: types
|
|
13
13
|
type RegisterPageClientProps = {
|