hazo_auth 1.6.6 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +212 -12
- package/SETUP_CHECKLIST.md +81 -1
- package/dist/app/api/hazo_auth/login/route.d.ts.map +1 -1
- package/dist/app/api/hazo_auth/login/route.js +25 -0
- package/dist/app/api/hazo_auth/logout/route.d.ts.map +1 -1
- package/dist/app/api/hazo_auth/logout/route.js +5 -0
- package/dist/components/layouts/email_verification/hooks/use_email_verification.d.ts.map +1 -1
- package/dist/components/layouts/email_verification/hooks/use_email_verification.js +5 -3
- package/dist/components/layouts/email_verification/index.d.ts +2 -1
- package/dist/components/layouts/email_verification/index.d.ts.map +1 -1
- package/dist/components/layouts/forgot_password/hooks/use_forgot_password_form.d.ts.map +1 -1
- package/dist/components/layouts/forgot_password/hooks/use_forgot_password_form.js +3 -1
- package/dist/components/layouts/forgot_password/index.d.ts +2 -1
- package/dist/components/layouts/forgot_password/index.d.ts.map +1 -1
- package/dist/components/layouts/login/hooks/use_login_form.d.ts.map +1 -1
- package/dist/components/layouts/login/hooks/use_login_form.js +3 -1
- package/dist/components/layouts/login/index.d.ts +2 -1
- package/dist/components/layouts/login/index.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/components/profile_picture_dialog.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/components/profile_picture_dialog.js +3 -1
- package/dist/components/layouts/my_settings/components/profile_picture_library_tab.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/components/profile_picture_library_tab.js +4 -2
- package/dist/components/layouts/my_settings/hooks/use_my_settings.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/hooks/use_my_settings.js +7 -5
- package/dist/components/layouts/my_settings/index.d.ts +2 -1
- package/dist/components/layouts/my_settings/index.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/index.js +3 -2
- package/dist/components/layouts/register/hooks/use_register_form.d.ts.map +1 -1
- package/dist/components/layouts/register/hooks/use_register_form.js +37 -7
- package/dist/components/layouts/register/index.d.ts +2 -1
- package/dist/components/layouts/register/index.d.ts.map +1 -1
- package/dist/components/layouts/reset_password/hooks/use_reset_password_form.d.ts.map +1 -1
- package/dist/components/layouts/reset_password/hooks/use_reset_password_form.js +4 -2
- package/dist/components/layouts/reset_password/index.d.ts +2 -1
- package/dist/components/layouts/reset_password/index.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/already_logged_in_guard.d.ts +2 -1
- package/dist/components/layouts/shared/components/already_logged_in_guard.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/logout_button.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/logout_button.js +3 -1
- package/dist/components/layouts/shared/components/profile_pic_menu.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/profile_pic_menu.js +8 -4
- package/dist/components/layouts/shared/components/two_column_auth_layout.d.ts +2 -1
- package/dist/components/layouts/shared/components/two_column_auth_layout.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/visual_panel.d.ts +2 -1
- package/dist/components/layouts/shared/components/visual_panel.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/visual_panel.js +2 -1
- package/dist/components/layouts/shared/hooks/use_auth_status.d.ts.map +1 -1
- package/dist/components/layouts/shared/hooks/use_auth_status.js +4 -2
- package/dist/components/layouts/shared/hooks/use_hazo_auth.d.ts.map +1 -1
- package/dist/components/layouts/shared/hooks/use_hazo_auth.js +4 -2
- package/dist/components/layouts/shared/index.d.ts +0 -2
- package/dist/components/layouts/shared/index.d.ts.map +1 -1
- package/dist/components/layouts/shared/index.js +2 -2
- package/dist/components/layouts/user_management/components/roles_matrix.d.ts.map +1 -1
- package/dist/components/layouts/user_management/components/roles_matrix.js +8 -6
- package/dist/components/layouts/user_management/index.d.ts.map +1 -1
- package/dist/components/layouts/user_management/index.js +15 -13
- package/dist/contexts/hazo_auth_config.d.ts +18 -0
- package/dist/contexts/hazo_auth_config.d.ts.map +1 -0
- package/dist/contexts/hazo_auth_config.js +10 -0
- package/dist/contexts/hazo_auth_provider.d.ts +73 -0
- package/dist/contexts/hazo_auth_provider.d.ts.map +1 -0
- package/dist/contexts/hazo_auth_provider.js +82 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/lib/auth/hazo_get_auth.server.d.ts.map +1 -1
- package/dist/lib/auth/hazo_get_auth.server.js +31 -3
- package/dist/lib/auth/session_token_validator.edge.d.ts +15 -0
- package/dist/lib/auth/session_token_validator.edge.d.ts.map +1 -0
- package/dist/lib/auth/session_token_validator.edge.js +64 -0
- package/dist/lib/config/default_config.d.ts +237 -0
- package/dist/lib/config/default_config.d.ts.map +1 -0
- package/dist/lib/config/default_config.js +159 -0
- package/dist/lib/email_verification_config.server.d.ts +4 -0
- package/dist/lib/email_verification_config.server.d.ts.map +1 -1
- package/dist/lib/email_verification_config.server.js +12 -0
- package/dist/lib/forgot_password_config.server.d.ts +4 -0
- package/dist/lib/forgot_password_config.server.d.ts.map +1 -1
- package/dist/lib/forgot_password_config.server.js +12 -0
- package/dist/lib/login_config.server.d.ts +4 -0
- package/dist/lib/login_config.server.d.ts.map +1 -1
- package/dist/lib/login_config.server.js +10 -0
- package/dist/lib/password_requirements_config.server.d.ts +1 -1
- package/dist/lib/password_requirements_config.server.d.ts.map +1 -1
- package/dist/lib/password_requirements_config.server.js +8 -7
- package/dist/lib/register_config.server.d.ts +4 -0
- package/dist/lib/register_config.server.d.ts.map +1 -1
- package/dist/lib/register_config.server.js +10 -0
- package/dist/lib/reset_password_config.server.d.ts +4 -0
- package/dist/lib/reset_password_config.server.d.ts.map +1 -1
- package/dist/lib/reset_password_config.server.js +10 -0
- package/dist/lib/services/session_token_service.d.ts +27 -0
- package/dist/lib/services/session_token_service.d.ts.map +1 -0
- package/dist/lib/services/session_token_service.js +130 -0
- package/dist/page_components/forgot_password.d.ts.map +1 -1
- package/dist/page_components/forgot_password.js +14 -0
- package/dist/page_components/login.d.ts +4 -0
- package/dist/page_components/login.d.ts.map +1 -1
- package/dist/page_components/login.js +14 -0
- package/dist/page_components/register.d.ts.map +1 -1
- package/dist/page_components/register.js +14 -0
- package/dist/page_components/reset_password.d.ts.map +1 -1
- package/dist/page_components/reset_password.js +14 -0
- package/dist/page_components/verify_email.d.ts.map +1 -1
- package/dist/page_components/verify_email.js +14 -0
- package/dist/pages/forgot_password.d.ts +52 -0
- package/dist/pages/forgot_password.d.ts.map +1 -0
- package/dist/pages/forgot_password.js +41 -0
- package/dist/pages/index.d.ts +33 -0
- package/dist/pages/index.d.ts.map +1 -0
- package/dist/pages/index.js +28 -0
- package/dist/pages/login.d.ts +43 -0
- package/dist/pages/login.d.ts.map +1 -0
- package/dist/pages/login.js +45 -0
- package/dist/pages/my_settings.d.ts +54 -0
- package/dist/pages/my_settings.d.ts.map +1 -0
- package/dist/pages/my_settings.js +57 -0
- package/dist/pages/register.d.ts +44 -0
- package/dist/pages/register.d.ts.map +1 -0
- package/dist/pages/register.js +46 -0
- package/dist/pages/reset_password.d.ts +43 -0
- package/dist/pages/reset_password.d.ts.map +1 -0
- package/dist/pages/reset_password.js +42 -0
- package/dist/pages/verify_email.d.ts +52 -0
- package/dist/pages/verify_email.d.ts.map +1 -0
- package/dist/pages/verify_email.js +41 -0
- package/dist/server/middleware.d.ts +3 -0
- package/dist/server/middleware.d.ts.map +1 -0
- package/dist/server/middleware.js +5 -0
- package/dist/server_pages/forgot_password.d.ts +53 -0
- package/dist/server_pages/forgot_password.d.ts.map +1 -0
- package/dist/server_pages/forgot_password.js +40 -0
- package/dist/server_pages/forgot_password_client_wrapper.d.ts +15 -0
- package/dist/server_pages/forgot_password_client_wrapper.d.ts.map +1 -0
- package/dist/server_pages/forgot_password_client_wrapper.js +27 -0
- package/dist/server_pages/index.d.ts +13 -0
- package/dist/server_pages/index.d.ts.map +1 -0
- package/dist/server_pages/index.js +7 -0
- package/dist/server_pages/login.d.ts +43 -0
- package/dist/server_pages/login.d.ts.map +1 -0
- package/dist/server_pages/login.js +39 -0
- package/dist/server_pages/login_client_wrapper.d.ts +13 -0
- package/dist/server_pages/login_client_wrapper.d.ts.map +1 -0
- package/dist/server_pages/login_client_wrapper.js +29 -0
- package/dist/server_pages/my_settings.d.ts +53 -0
- package/dist/server_pages/my_settings.d.ts.map +1 -0
- package/dist/server_pages/my_settings.js +57 -0
- package/dist/server_pages/register.d.ts +45 -0
- package/dist/server_pages/register.d.ts.map +1 -0
- package/dist/server_pages/register.js +41 -0
- package/dist/server_pages/register_client_wrapper.d.ts +13 -0
- package/dist/server_pages/register_client_wrapper.d.ts.map +1 -0
- package/dist/server_pages/register_client_wrapper.js +27 -0
- package/dist/server_pages/reset_password.d.ts +44 -0
- package/dist/server_pages/reset_password.d.ts.map +1 -0
- package/dist/server_pages/reset_password.js +40 -0
- package/dist/server_pages/reset_password_client_wrapper.d.ts +13 -0
- package/dist/server_pages/reset_password_client_wrapper.d.ts.map +1 -0
- package/dist/server_pages/reset_password_client_wrapper.js +27 -0
- package/dist/server_pages/verify_email.d.ts +53 -0
- package/dist/server_pages/verify_email.d.ts.map +1 -0
- package/dist/server_pages/verify_email.js +40 -0
- package/dist/server_pages/verify_email_client_wrapper.d.ts +15 -0
- package/dist/server_pages/verify_email_client_wrapper.d.ts.map +1 -0
- package/dist/server_pages/verify_email_client_wrapper.js +27 -0
- package/package.json +39 -10
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// file_description: Edge-compatible JWT session token validator for Next.js proxy/middleware
|
|
2
|
+
// Uses jose library which works in Edge Runtime
|
|
3
|
+
// section: imports
|
|
4
|
+
import { jwtVerify } from "jose";
|
|
5
|
+
// section: helpers
|
|
6
|
+
/**
|
|
7
|
+
* Gets JWT secret from environment variables
|
|
8
|
+
* Works in Edge Runtime (no Node.js APIs)
|
|
9
|
+
* @returns JWT secret as Uint8Array for jose library
|
|
10
|
+
*/
|
|
11
|
+
function get_jwt_secret() {
|
|
12
|
+
const jwt_secret = process.env.JWT_SECRET;
|
|
13
|
+
if (!jwt_secret) {
|
|
14
|
+
// In Edge Runtime, we can't use logger, so we just return null
|
|
15
|
+
// The validation will fail gracefully
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
// Convert string secret to Uint8Array for jose
|
|
19
|
+
return new TextEncoder().encode(jwt_secret);
|
|
20
|
+
}
|
|
21
|
+
// section: main_function
|
|
22
|
+
/**
|
|
23
|
+
* Validates session cookie from NextRequest (Edge-compatible)
|
|
24
|
+
* Extracts hazo_auth_session cookie and validates JWT signature and expiry
|
|
25
|
+
* Works in Edge Runtime (Next.js proxy/middleware)
|
|
26
|
+
* @param request - NextRequest object
|
|
27
|
+
* @returns Validation result with user_id and email if valid
|
|
28
|
+
*/
|
|
29
|
+
export async function validate_session_cookie(request) {
|
|
30
|
+
var _a;
|
|
31
|
+
try {
|
|
32
|
+
// Extract session cookie
|
|
33
|
+
const session_cookie = (_a = request.cookies.get("hazo_auth_session")) === null || _a === void 0 ? void 0 : _a.value;
|
|
34
|
+
if (!session_cookie) {
|
|
35
|
+
return { valid: false };
|
|
36
|
+
}
|
|
37
|
+
// Get JWT secret
|
|
38
|
+
const secret = get_jwt_secret();
|
|
39
|
+
if (!secret) {
|
|
40
|
+
// JWT_SECRET not set - cannot validate
|
|
41
|
+
return { valid: false };
|
|
42
|
+
}
|
|
43
|
+
// Verify JWT signature and expiration
|
|
44
|
+
const { payload } = await jwtVerify(session_cookie, secret, {
|
|
45
|
+
algorithms: ["HS256"],
|
|
46
|
+
});
|
|
47
|
+
// Extract user_id and email from payload
|
|
48
|
+
const user_id = payload.user_id;
|
|
49
|
+
const email = payload.email;
|
|
50
|
+
if (!user_id || !email) {
|
|
51
|
+
return { valid: false };
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
valid: true,
|
|
55
|
+
user_id,
|
|
56
|
+
email,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
// jose throws JWTExpired, JWTInvalid, etc. - these are expected for invalid tokens
|
|
61
|
+
// In Edge Runtime, we can't log, so we just return invalid
|
|
62
|
+
return { valid: false };
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -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":"
|
|
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":"
|
|
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"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// file_description: server-only helper to read forgot password 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 forgotPasswordDefaultImage from "../assets/images/forgot_password_default.jpg";
|
|
4
6
|
// section: helpers
|
|
5
7
|
/**
|
|
6
8
|
* Reads forgot password 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 Forgot password configuration options
|
|
9
11
|
*/
|
|
10
12
|
export function get_forgot_password_config() {
|
|
13
|
+
const section = "hazo_auth__forgot_password_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
|
+
) || forgotPasswordDefaultImage;
|
|
20
|
+
const imageAlt = get_config_value(section, "image_alt", "Password recovery 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,3 +1,4 @@
|
|
|
1
|
+
import type { StaticImageData } from "next/image";
|
|
1
2
|
export type LoginConfig = {
|
|
2
3
|
redirectRoute?: string;
|
|
3
4
|
successMessage: string;
|
|
@@ -10,6 +11,9 @@ export type LoginConfig = {
|
|
|
10
11
|
forgotPasswordLabel: string;
|
|
11
12
|
createAccountPath: string;
|
|
12
13
|
createAccountLabel: string;
|
|
14
|
+
imageSrc: string | StaticImageData;
|
|
15
|
+
imageAlt: string;
|
|
16
|
+
imageBackgroundColor: string;
|
|
13
17
|
};
|
|
14
18
|
/**
|
|
15
19
|
* Reads login layout configuration from hazo_auth_config.ini file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/login_config.server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"login_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/login_config.server.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,MAAM,WAAW,GAAG;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,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,kBAAkB,EAAE,MAAM,CAAC;IAC3B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE,MAAM,GAAG,eAAe,CAAC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CAAC;AAGF;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,WAAW,CAiE9C"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// section: imports
|
|
3
3
|
import { get_config_value } from "./config/config_loader.server";
|
|
4
4
|
import { get_already_logged_in_config } from "./already_logged_in_config.server";
|
|
5
|
+
import loginDefaultImage from "../assets/images/login_default.jpg";
|
|
5
6
|
// section: helpers
|
|
6
7
|
/**
|
|
7
8
|
* Reads login layout configuration from hazo_auth_config.ini file
|
|
@@ -21,6 +22,12 @@ export function get_login_config() {
|
|
|
21
22
|
const createAccountLabel = get_config_value(section, "create_account_label", "Create account");
|
|
22
23
|
// Get shared already logged in config
|
|
23
24
|
const alreadyLoggedInConfig = get_already_logged_in_config();
|
|
25
|
+
// Read image configuration
|
|
26
|
+
// If not set in config, falls back to default image from assets
|
|
27
|
+
const imageSrc = get_config_value(section, "image_src", "" // Empty string means not set in config
|
|
28
|
+
) || loginDefaultImage;
|
|
29
|
+
const imageAlt = get_config_value(section, "image_alt", "Secure login illustration");
|
|
30
|
+
const imageBackgroundColor = get_config_value(section, "image_background_color", "#f1f5f9");
|
|
24
31
|
return {
|
|
25
32
|
redirectRoute,
|
|
26
33
|
successMessage,
|
|
@@ -33,5 +40,8 @@ export function get_login_config() {
|
|
|
33
40
|
forgotPasswordLabel,
|
|
34
41
|
createAccountPath,
|
|
35
42
|
createAccountLabel,
|
|
43
|
+
imageSrc,
|
|
44
|
+
imageAlt,
|
|
45
|
+
imageBackgroundColor,
|
|
36
46
|
};
|
|
37
47
|
}
|
|
@@ -7,7 +7,7 @@ export type PasswordRequirementsConfig = {
|
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
9
|
* Reads shared password requirements configuration from hazo_auth_config.ini file
|
|
10
|
-
* Falls back to defaults if hazo_auth_config.ini is not found or section is missing
|
|
10
|
+
* Falls back to centralized defaults if hazo_auth_config.ini is not found or section is missing
|
|
11
11
|
* This configuration is used by both register and reset password layouts
|
|
12
12
|
* @returns Password requirements configuration options
|
|
13
13
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"password_requirements_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/password_requirements_config.server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"password_requirements_config.server.d.ts","sourceRoot":"","sources":["../../src/lib/password_requirements_config.server.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,0BAA0B,GAAG;IACvC,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAGF;;;;;GAKG;AACH,wBAAgB,gCAAgC,IAAI,0BAA0B,CAiB7E"}
|