hazo_auth 10.8.2 → 10.11.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 +40 -0
- package/SETUP_CHECKLIST.md +49 -0
- package/cli-src/cli/generate.ts +1 -0
- package/cli-src/lib/auth/with_auth.server.ts +65 -23
- package/cli-src/lib/cookies_config.server.ts +50 -0
- package/cli-src/lib/my_settings_config.server.ts +5 -1
- package/cli-src/lib/services/account_deletion_service.ts +67 -0
- package/cli-src/lib/services/index.ts +1 -0
- package/config/hazo_auth_config.example.ini +25 -19
- package/dist/admin-issues/install_permission_ux.server.d.ts +26 -0
- package/dist/admin-issues/install_permission_ux.server.d.ts.map +1 -0
- package/dist/admin-issues/install_permission_ux.server.js +27 -0
- package/dist/admin-issues/permission_denied_provider.client.d.ts +19 -0
- package/dist/admin-issues/permission_denied_provider.client.d.ts.map +1 -1
- package/dist/admin-issues/permission_denied_provider.client.js +46 -2
- package/dist/cli/generate.d.ts.map +1 -1
- package/dist/cli/generate.js +1 -0
- package/dist/client.d.ts +2 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +1 -1
- package/dist/components/layouts/my_settings/components/danger_zone_section.d.ts +34 -0
- package/dist/components/layouts/my_settings/components/danger_zone_section.d.ts.map +1 -0
- package/dist/components/layouts/my_settings/components/danger_zone_section.js +93 -0
- package/dist/components/layouts/my_settings/index.d.ts +6 -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/permission_denied_dialog.client.js +1 -1
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/hooks.d.ts +5 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +29 -0
- package/dist/lib/auth/with_auth.server.d.ts.map +1 -1
- package/dist/lib/auth/with_auth.server.js +51 -15
- package/dist/lib/cookies_config.server.d.ts +20 -0
- package/dist/lib/cookies_config.server.d.ts.map +1 -1
- package/dist/lib/cookies_config.server.js +43 -0
- package/dist/lib/my_settings_config.server.d.ts +2 -0
- package/dist/lib/my_settings_config.server.d.ts.map +1 -1
- package/dist/lib/my_settings_config.server.js +3 -1
- package/dist/lib/services/account_deletion_service.d.ts +22 -0
- package/dist/lib/services/account_deletion_service.d.ts.map +1 -0
- package/dist/lib/services/account_deletion_service.js +55 -0
- package/dist/lib/services/index.d.ts +1 -0
- package/dist/lib/services/index.d.ts.map +1 -1
- package/dist/lib/services/index.js +1 -0
- package/dist/page_components/my_settings.d.ts +6 -1
- package/dist/page_components/my_settings.d.ts.map +1 -1
- package/dist/page_components/my_settings.js +2 -2
- package/dist/server/routes/delete_account.d.ts +17 -0
- package/dist/server/routes/delete_account.d.ts.map +1 -0
- package/dist/server/routes/delete_account.js +107 -0
- package/dist/server/routes/index.d.ts +1 -0
- package/dist/server/routes/index.d.ts.map +1 -1
- package/dist/server/routes/index.js +1 -0
- package/dist/server/routes/logout.d.ts.map +1 -1
- package/dist/server/routes/logout.js +4 -40
- package/dist/server-lib.d.ts +2 -0
- package/dist/server-lib.d.ts.map +1 -1
- package/dist/server-lib.js +1 -0
- package/dist/server_pages/my_settings.d.ts.map +1 -1
- package/dist/server_pages/my_settings.js +1 -1
- package/package.json +15 -11
- package/dist/page_components/forgot_password.d.ts +0 -19
- package/dist/page_components/forgot_password.d.ts.map +0 -1
- package/dist/page_components/forgot_password.js +0 -50
- package/dist/page_components/login.d.ts +0 -30
- package/dist/page_components/login.d.ts.map +0 -1
- package/dist/page_components/login.js +0 -50
- package/dist/page_components/register.d.ts +0 -25
- package/dist/page_components/register.d.ts.map +0 -1
- package/dist/page_components/register.js +0 -57
- package/dist/page_components/reset_password.d.ts +0 -25
- package/dist/page_components/reset_password.d.ts.map +0 -1
- package/dist/page_components/reset_password.js +0 -57
- package/dist/page_components/verify_email.d.ts +0 -21
- package/dist/page_components/verify_email.d.ts.map +0 -1
- package/dist/page_components/verify_email.js +0 -50
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// file_description: service for self-service (hard) deletion of the caller's own hazo_users row
|
|
2
|
+
// section: imports
|
|
3
|
+
import { createCrudService } from "hazo_connect/server";
|
|
4
|
+
import { get_hazo_connect_instance } from "../hazo_connect_instance.server.js";
|
|
5
|
+
import { create_app_logger } from "../app_logger.js";
|
|
6
|
+
import { sanitize_error_for_user } from "../utils/error_sanitizer.js";
|
|
7
|
+
import { get_line_number } from "../utils/api_route_helpers.js";
|
|
8
|
+
// section: main_function
|
|
9
|
+
/**
|
|
10
|
+
* Hard-deletes the caller's own `hazo_users` row.
|
|
11
|
+
*
|
|
12
|
+
* Child rows cascade automatically via `ON DELETE CASCADE` foreign keys
|
|
13
|
+
* (hazo_refresh_tokens, hazo_user_scopes, hazo_user_relationships,
|
|
14
|
+
* hazo_email_otps, hazo_legal_acceptances, hazo_google_oauth_tokens,
|
|
15
|
+
* hazo_user_roles) — no manual cleanup needed. A few "created by" /
|
|
16
|
+
* "managed by" references (hazo_users.managed_by_user_id,
|
|
17
|
+
* hazo_invitations.invited_by, hazo_legal_doc_versions.published_by_user_id)
|
|
18
|
+
* intentionally use `ON DELETE SET NULL` instead of CASCADE, by design —
|
|
19
|
+
* they preserve audit/history/relationship rows rather than deleting them,
|
|
20
|
+
* so they likewise require no manual cleanup here.
|
|
21
|
+
*
|
|
22
|
+
* @param user_id - The authenticated caller's own user ID (never another user's)
|
|
23
|
+
* @returns AccountDeletionResult with success status or error
|
|
24
|
+
*/
|
|
25
|
+
export async function delete_own_account(user_id) {
|
|
26
|
+
try {
|
|
27
|
+
const adapter = get_hazo_connect_instance();
|
|
28
|
+
const users_service = createCrudService(adapter, "hazo_users");
|
|
29
|
+
// Verify the user still exists before deleting
|
|
30
|
+
const users = await users_service.findBy({ id: user_id });
|
|
31
|
+
if (!Array.isArray(users) || users.length === 0) {
|
|
32
|
+
return { success: false, error: "User not found" };
|
|
33
|
+
}
|
|
34
|
+
await users_service.deleteById(user_id);
|
|
35
|
+
return { success: true };
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
const logger = create_app_logger();
|
|
39
|
+
const user_friendly_error = sanitize_error_for_user(error, {
|
|
40
|
+
logToConsole: true,
|
|
41
|
+
logToLogger: true,
|
|
42
|
+
logger,
|
|
43
|
+
context: {
|
|
44
|
+
filename: "account_deletion_service.ts",
|
|
45
|
+
line_number: get_line_number(),
|
|
46
|
+
user_id,
|
|
47
|
+
operation: "delete_own_account",
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
return {
|
|
51
|
+
success: false,
|
|
52
|
+
error: user_friendly_error,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/services/index.ts"],"names":[],"mappings":"AAEA,cAAc,iBAAiB,CAAC;AAChC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/services/index.ts"],"names":[],"mappings":"AAEA,cAAc,iBAAiB,CAAC;AAChC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC"}
|
|
@@ -46,6 +46,11 @@ export type MySettingsPageProps = {
|
|
|
46
46
|
unauthorizedMessage?: string;
|
|
47
47
|
loginButtonLabel?: string;
|
|
48
48
|
loginPath?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Whether the Danger Zone (account deletion) section is shown.
|
|
51
|
+
* Mirrors the `enable_account_deletion` config flag; defaults to off (opt-in).
|
|
52
|
+
*/
|
|
53
|
+
enableAccountDeletion?: boolean;
|
|
49
54
|
messages?: Partial<typeof DEFAULT_MESSAGES>;
|
|
50
55
|
uiSizes?: Partial<typeof DEFAULT_UI_SIZES>;
|
|
51
56
|
fileTypes?: {
|
|
@@ -59,6 +64,6 @@ export type MySettingsPageProps = {
|
|
|
59
64
|
* @param props - Optional configuration overrides
|
|
60
65
|
* @returns My settings page component
|
|
61
66
|
*/
|
|
62
|
-
export declare function MySettingsPage({ userFields, passwordRequirements, profilePicture, heading, subHeading, profilePhotoLabel, profilePhotoRecommendation, uploadPhotoButtonLabel, removePhotoButtonLabel, profileInformationLabel, passwordLabel, currentPasswordLabel, newPasswordLabel, confirmPasswordLabel, savePasswordButtonLabel, unauthorizedMessage, loginButtonLabel, loginPath, messages, uiSizes, fileTypes, }?: MySettingsPageProps): import("react").JSX.Element;
|
|
67
|
+
export declare function MySettingsPage({ userFields, passwordRequirements, profilePicture, heading, subHeading, profilePhotoLabel, profilePhotoRecommendation, uploadPhotoButtonLabel, removePhotoButtonLabel, profileInformationLabel, passwordLabel, currentPasswordLabel, newPasswordLabel, confirmPasswordLabel, savePasswordButtonLabel, unauthorizedMessage, loginButtonLabel, loginPath, enableAccountDeletion, messages, uiSizes, fileTypes, }?: MySettingsPageProps): import("react").JSX.Element;
|
|
63
68
|
export default MySettingsPage;
|
|
64
69
|
//# sourceMappingURL=my_settings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"my_settings.d.ts","sourceRoot":"","sources":["../../src/page_components/my_settings.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0DAA0D,CAAC;AA2B3G,QAAA,MAAM,gBAAgB;;;;;CAKrB,CAAC;AAEF,QAAA,MAAM,gBAAgB;;;;;;;;;CASrB,CAAC;AAQF,MAAM,MAAM,mBAAmB,GAAG;IAChC,UAAU,CAAC,EAAE;QACX,eAAe,CAAC,EAAE,OAAO,CAAC;QAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;QAC3B,mBAAmB,CAAC,EAAE,OAAO,CAAC;KAC/B,CAAC;IACF,oBAAoB,CAAC,EAAE,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAC3D,cAAc,CAAC,EAAE;QACf,kBAAkB,CAAC,EAAE,OAAO,CAAC;QAC7B,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,kBAAkB,CAAC,EAAE,OAAO,CAAC;QAC7B,4BAA4B,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;QACtD,4BAA4B,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;QACtD,kBAA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;IAC9B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC,OAAO,gBAAgB,CAAC,CAAC;IAC5C,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,gBAAgB,CAAC,CAAC;IAC3C,SAAS,CAAC,EAAE;QACV,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;QACpC,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;KACrC,CAAC;CACH,CAAC;AAGF;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAC7B,UAAU,EACV,oBAAoB,EACpB,cAAc,EACd,OAA4B,EAC5B,UAAoE,EACpE,iBAAmC,EACnC,0BAAiF,EACjF,sBAAuC,EACvC,sBAAiC,EACjC,uBAA+C,EAC/C,aAA0B,EAC1B,oBAAyC,EACzC,gBAAiC,EACjC,oBAAyC,EACzC,uBAA2C,EAC3C,mBAAkE,EAClE,gBAAgC,EAChC,SAA8B,EAC9B,qBAA6B,EAC7B,QAAQ,EACR,OAAO,EACP,SAAS,GACV,GAAE,mBAAwB,+BA2D1B;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -53,7 +53,7 @@ const DEFAULT_FILE_TYPES = {
|
|
|
53
53
|
* @param props - Optional configuration overrides
|
|
54
54
|
* @returns My settings page component
|
|
55
55
|
*/
|
|
56
|
-
export function MySettingsPage({ userFields, passwordRequirements, profilePicture, heading = "Account Settings", subHeading = "Manage your profile, password, and email preferences.", profilePhotoLabel = "Profile Photo", profilePhotoRecommendation = "Recommended: Square image, at least 200x200 pixels", uploadPhotoButtonLabel = "Upload Photo", removePhotoButtonLabel = "Remove", profileInformationLabel = "Profile Information", passwordLabel = "Password", currentPasswordLabel = "Current Password", newPasswordLabel = "New Password", confirmPasswordLabel = "Confirm Password", savePasswordButtonLabel = "Update Password", unauthorizedMessage = "You must be logged in to access this page.", loginButtonLabel = "Go to login", loginPath = "/hazo_auth/login", messages, uiSizes, fileTypes, } = {}) {
|
|
56
|
+
export function MySettingsPage({ userFields, passwordRequirements, profilePicture, heading = "Account Settings", subHeading = "Manage your profile, password, and email preferences.", profilePhotoLabel = "Profile Photo", profilePhotoRecommendation = "Recommended: Square image, at least 200x200 pixels", uploadPhotoButtonLabel = "Upload Photo", removePhotoButtonLabel = "Remove", profileInformationLabel = "Profile Information", passwordLabel = "Password", currentPasswordLabel = "Current Password", newPasswordLabel = "New Password", confirmPasswordLabel = "Confirm Password", savePasswordButtonLabel = "Update Password", unauthorizedMessage = "You must be logged in to access this page.", loginButtonLabel = "Go to login", loginPath = "/hazo_auth/login", enableAccountDeletion = false, messages, uiSizes, fileTypes, } = {}) {
|
|
57
57
|
// Merge provided props with defaults
|
|
58
58
|
const mergedUserFields = Object.assign(Object.assign({}, DEFAULT_USER_FIELDS), userFields);
|
|
59
59
|
const mergedPasswordRequirements = Object.assign(Object.assign({}, DEFAULT_PASSWORD_REQUIREMENTS), passwordRequirements);
|
|
@@ -62,6 +62,6 @@ export function MySettingsPage({ userFields, passwordRequirements, profilePictur
|
|
|
62
62
|
const mergedUiSizes = Object.assign(Object.assign({}, DEFAULT_UI_SIZES), uiSizes);
|
|
63
63
|
const mergedFileTypes = Object.assign(Object.assign({}, DEFAULT_FILE_TYPES), fileTypes);
|
|
64
64
|
const MySettingsLayout = my_settings_layout;
|
|
65
|
-
return (_jsx(MySettingsLayout, { userFields: mergedUserFields, password_requirements: mergedPasswordRequirements, profilePicture: mergedProfilePicture, heading: heading, subHeading: subHeading, profilePhotoLabel: profilePhotoLabel, profilePhotoRecommendation: profilePhotoRecommendation, uploadPhotoButtonLabel: uploadPhotoButtonLabel, removePhotoButtonLabel: removePhotoButtonLabel, profileInformationLabel: profileInformationLabel, passwordLabel: passwordLabel, currentPasswordLabel: currentPasswordLabel, newPasswordLabel: newPasswordLabel, confirmPasswordLabel: confirmPasswordLabel, unauthorizedMessage: unauthorizedMessage, loginButtonLabel: loginButtonLabel, loginPath: loginPath, messages: mergedMessages, uiSizes: mergedUiSizes, fileTypes: mergedFileTypes }));
|
|
65
|
+
return (_jsx(MySettingsLayout, { userFields: mergedUserFields, password_requirements: mergedPasswordRequirements, profilePicture: mergedProfilePicture, heading: heading, subHeading: subHeading, profilePhotoLabel: profilePhotoLabel, profilePhotoRecommendation: profilePhotoRecommendation, uploadPhotoButtonLabel: uploadPhotoButtonLabel, removePhotoButtonLabel: removePhotoButtonLabel, profileInformationLabel: profileInformationLabel, passwordLabel: passwordLabel, currentPasswordLabel: currentPasswordLabel, newPasswordLabel: newPasswordLabel, confirmPasswordLabel: confirmPasswordLabel, unauthorizedMessage: unauthorizedMessage, loginButtonLabel: loginButtonLabel, loginPath: loginPath, enableAccountDeletion: enableAccountDeletion, messages: mergedMessages, uiSizes: mergedUiSizes, fileTypes: mergedFileTypes }));
|
|
66
66
|
}
|
|
67
67
|
export default MySettingsPage;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { NextRequest, NextResponse } from "next/server";
|
|
2
|
+
export declare const dynamic = "force-dynamic";
|
|
3
|
+
/**
|
|
4
|
+
* DELETE - Self-service hard-delete of the caller's own account.
|
|
5
|
+
* Body: { confirm_email: string } — must match the authenticated user's email
|
|
6
|
+
* address (case-insensitive) to confirm intent.
|
|
7
|
+
*
|
|
8
|
+
* Gated by `enable_account_deletion` (default: false) in the
|
|
9
|
+
* `[hazo_auth__my_settings_layout]` config section — opt-in, off by default.
|
|
10
|
+
*/
|
|
11
|
+
export declare function DELETE(request: NextRequest): Promise<NextResponse<{
|
|
12
|
+
error: string;
|
|
13
|
+
}> | NextResponse<{
|
|
14
|
+
success: boolean;
|
|
15
|
+
message: string;
|
|
16
|
+
}>>;
|
|
17
|
+
//# sourceMappingURL=delete_account.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete_account.d.ts","sourceRoot":"","sources":["../../../src/server/routes/delete_account.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAcxD,eAAO,MAAM,OAAO,kBAAkB,CAAC;AAGvC;;;;;;;GAOG;AACH,wBAAsB,MAAM,CAAC,OAAO,EAAE,WAAW;;;;;IAsHhD"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// file_description: API route handler for self-service (hard) account deletion
|
|
2
|
+
// section: imports
|
|
3
|
+
import { NextResponse } from "next/server";
|
|
4
|
+
import { hazo_get_auth } from "../../lib/auth/hazo_get_auth.server.js";
|
|
5
|
+
import { delete_own_account } from "../../lib/services/account_deletion_service.js";
|
|
6
|
+
import { create_app_logger } from "../../lib/app_logger.js";
|
|
7
|
+
import { get_filename, get_line_number } from "../../lib/utils/api_route_helpers.js";
|
|
8
|
+
import { get_auth_cache } from "../../lib/auth/auth_cache.js";
|
|
9
|
+
import { get_auth_utility_config } from "../../lib/auth_utility_config.server.js";
|
|
10
|
+
import { get_config_boolean } from "../../lib/config/config_loader.server.js";
|
|
11
|
+
import { clear_session_cookies, clear_nextauth_cookies } from "../../lib/cookies_config.server.js";
|
|
12
|
+
// section: constants
|
|
13
|
+
const MY_SETTINGS_SECTION = "hazo_auth__my_settings_layout";
|
|
14
|
+
// section: route_config
|
|
15
|
+
export const dynamic = "force-dynamic";
|
|
16
|
+
// section: api_handler
|
|
17
|
+
/**
|
|
18
|
+
* DELETE - Self-service hard-delete of the caller's own account.
|
|
19
|
+
* Body: { confirm_email: string } — must match the authenticated user's email
|
|
20
|
+
* address (case-insensitive) to confirm intent.
|
|
21
|
+
*
|
|
22
|
+
* Gated by `enable_account_deletion` (default: false) in the
|
|
23
|
+
* `[hazo_auth__my_settings_layout]` config section — opt-in, off by default.
|
|
24
|
+
*/
|
|
25
|
+
export async function DELETE(request) {
|
|
26
|
+
const logger = create_app_logger();
|
|
27
|
+
try {
|
|
28
|
+
// Resolve the caller
|
|
29
|
+
const auth = await hazo_get_auth(request);
|
|
30
|
+
if (!auth.user) {
|
|
31
|
+
return NextResponse.json({ error: "Authentication required" }, { status: 401 });
|
|
32
|
+
}
|
|
33
|
+
const user_id = auth.user.id;
|
|
34
|
+
// Feature is opt-in — refuse before doing any further work if disabled
|
|
35
|
+
const enabled = get_config_boolean(MY_SETTINGS_SECTION, "enable_account_deletion", false);
|
|
36
|
+
if (!enabled) {
|
|
37
|
+
logger.warn("account_deletion_disabled", {
|
|
38
|
+
filename: get_filename(),
|
|
39
|
+
line_number: get_line_number(),
|
|
40
|
+
user_id,
|
|
41
|
+
});
|
|
42
|
+
return NextResponse.json({ error: "Account deletion is not enabled" }, { status: 403 });
|
|
43
|
+
}
|
|
44
|
+
// Require the caller to re-type their own email address as confirmation
|
|
45
|
+
let body;
|
|
46
|
+
try {
|
|
47
|
+
body = await request.json();
|
|
48
|
+
}
|
|
49
|
+
catch (_a) {
|
|
50
|
+
body = {};
|
|
51
|
+
}
|
|
52
|
+
const confirm_email = typeof body.confirm_email === "string" ? body.confirm_email.trim() : "";
|
|
53
|
+
if (!confirm_email || confirm_email.toLowerCase() !== auth.user.email_address.toLowerCase()) {
|
|
54
|
+
logger.warn("account_deletion_confirmation_mismatch", {
|
|
55
|
+
filename: get_filename(),
|
|
56
|
+
line_number: get_line_number(),
|
|
57
|
+
user_id,
|
|
58
|
+
});
|
|
59
|
+
return NextResponse.json({ error: "Confirmation email does not match your account email" }, { status: 400 });
|
|
60
|
+
}
|
|
61
|
+
// Hard-delete the account (cascades to all related rows)
|
|
62
|
+
const result = await delete_own_account(user_id);
|
|
63
|
+
if (!result.success) {
|
|
64
|
+
logger.warn("account_deletion_failed", {
|
|
65
|
+
filename: get_filename(),
|
|
66
|
+
line_number: get_line_number(),
|
|
67
|
+
user_id,
|
|
68
|
+
error: result.error,
|
|
69
|
+
});
|
|
70
|
+
return NextResponse.json({ error: result.error || "Failed to delete account" }, { status: 400 });
|
|
71
|
+
}
|
|
72
|
+
// Invalidate auth cache now that the user is gone
|
|
73
|
+
try {
|
|
74
|
+
const auth_config = get_auth_utility_config();
|
|
75
|
+
const auth_cache = get_auth_cache(auth_config.cache_max_users, auth_config.cache_ttl_minutes, auth_config.cache_max_age_minutes);
|
|
76
|
+
auth_cache.invalidate_user(user_id);
|
|
77
|
+
}
|
|
78
|
+
catch (_b) {
|
|
79
|
+
// Non-fatal
|
|
80
|
+
}
|
|
81
|
+
logger.info("account_deletion_successful", {
|
|
82
|
+
filename: get_filename(),
|
|
83
|
+
line_number: get_line_number(),
|
|
84
|
+
user_id,
|
|
85
|
+
});
|
|
86
|
+
const response = NextResponse.json({
|
|
87
|
+
success: true,
|
|
88
|
+
message: "Account deleted successfully",
|
|
89
|
+
}, { status: 200 });
|
|
90
|
+
// Clear the three core hazo_auth session cookies — the account (and its session) no longer exists
|
|
91
|
+
clear_session_cookies(response);
|
|
92
|
+
// Also clear NextAuth cookies — a Google-OAuth user must not be left holding a live session-token
|
|
93
|
+
clear_nextauth_cookies(response);
|
|
94
|
+
return response;
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
const error_message = error instanceof Error ? error.message : "Unknown error";
|
|
98
|
+
const error_stack = error instanceof Error ? error.stack : undefined;
|
|
99
|
+
logger.error("account_deletion_error", {
|
|
100
|
+
filename: get_filename(),
|
|
101
|
+
line_number: get_line_number(),
|
|
102
|
+
error_message,
|
|
103
|
+
error_stack,
|
|
104
|
+
});
|
|
105
|
+
return NextResponse.json({ error: "Failed to delete account. Please try again." }, { status: 500 });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -11,6 +11,7 @@ export { POST as resendVerificationPOST } from "./resend_verification.js";
|
|
|
11
11
|
export { PATCH as updateUserPATCH } from "./update_user.js";
|
|
12
12
|
export { POST as uploadProfilePicturePOST } from "./upload_profile_picture.js";
|
|
13
13
|
export { DELETE as removeProfilePictureDELETE } from "./remove_profile_picture.js";
|
|
14
|
+
export { DELETE as deleteAccountDELETE } from "./delete_account.js";
|
|
14
15
|
export { GET as libraryPhotosGET } from "./library_photos.js";
|
|
15
16
|
export { GET as libraryPhotoGET } from "./library_photo.js";
|
|
16
17
|
export { GET as profilePictureFilenameGET } from "./profile_picture_filename.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/routes/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,IAAI,IAAI,YAAY,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,GAAG,IAAI,KAAK,EAAE,MAAM,MAAM,CAAC;AAGpC,OAAO,EAAE,IAAI,IAAI,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,IAAI,IAAI,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,IAAI,IAAI,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,GAAG,IAAI,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAGtE,OAAO,EAAE,GAAG,IAAI,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,IAAI,IAAI,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAGvE,OAAO,EAAE,KAAK,IAAI,eAAe,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,IAAI,IAAI,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,MAAM,IAAI,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,GAAG,IAAI,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,GAAG,I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AAC;AACjJ,OAAO,EAAE,IAAI,IAAI,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,IAAI,IAAI,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,IAAI,IAAI,YAAY,EAAE,MAAM,aAAa,CAAC;AAGnD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAG5D,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGxD,OAAO,EAAE,GAAG,IAAI,cAAc,EAAE,MAAM,IAAI,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAIpF,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -17,6 +17,7 @@ export { POST as resendVerificationPOST } from "./resend_verification.js";
|
|
|
17
17
|
export { PATCH as updateUserPATCH } from "./update_user.js";
|
|
18
18
|
export { POST as uploadProfilePicturePOST } from "./upload_profile_picture.js";
|
|
19
19
|
export { DELETE as removeProfilePictureDELETE } from "./remove_profile_picture.js";
|
|
20
|
+
export { DELETE as deleteAccountDELETE } from "./delete_account.js";
|
|
20
21
|
export { GET as libraryPhotosGET } from "./library_photos.js";
|
|
21
22
|
export { GET as libraryPhotoGET } from "./library_photo.js";
|
|
22
23
|
export { GET as profilePictureFilenameGET } from "./profile_picture_filename.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../src/server/routes/logout.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQxD,wBAAsB,IAAI,CAAC,OAAO,EAAE,WAAW;;;;;
|
|
1
|
+
{"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../../src/server/routes/logout.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQxD,wBAAsB,IAAI,CAAC,OAAO,EAAE,WAAW;;;;;IA0E9C"}
|
|
@@ -5,7 +5,7 @@ import { create_app_logger } from "../../lib/app_logger.js";
|
|
|
5
5
|
import { get_filename, get_line_number } from "../../lib/utils/api_route_helpers.js";
|
|
6
6
|
import { get_auth_cache } from "../../lib/auth/auth_cache.js";
|
|
7
7
|
import { get_auth_utility_config } from "../../lib/auth_utility_config.server.js";
|
|
8
|
-
import { get_cookie_name,
|
|
8
|
+
import { get_cookie_name, BASE_COOKIE_NAMES, clear_session_cookies, clear_nextauth_cookies } from "../../lib/cookies_config.server.js";
|
|
9
9
|
// section: api_handler
|
|
10
10
|
export async function POST(request) {
|
|
11
11
|
var _a, _b;
|
|
@@ -19,46 +19,10 @@ export async function POST(request) {
|
|
|
19
19
|
success: true,
|
|
20
20
|
message: "Logout successful",
|
|
21
21
|
}, { status: 200 });
|
|
22
|
-
// Clear
|
|
23
|
-
|
|
24
|
-
expires: new Date(0),
|
|
25
|
-
path: "/",
|
|
26
|
-
});
|
|
27
|
-
response.cookies.set(get_cookie_name(BASE_COOKIE_NAMES.USER_EMAIL), "", clear_cookie_options);
|
|
28
|
-
response.cookies.set(get_cookie_name(BASE_COOKIE_NAMES.USER_ID), "", clear_cookie_options);
|
|
29
|
-
// Clear JWT session token cookie
|
|
30
|
-
response.cookies.set(get_cookie_name(BASE_COOKIE_NAMES.SESSION), "", clear_cookie_options);
|
|
22
|
+
// Clear the three core hazo_auth session cookies (USER_EMAIL, USER_ID, SESSION)
|
|
23
|
+
clear_session_cookies(response);
|
|
31
24
|
// Clear NextAuth session cookies (for OAuth users)
|
|
32
|
-
response
|
|
33
|
-
expires: new Date(0),
|
|
34
|
-
path: "/",
|
|
35
|
-
});
|
|
36
|
-
response.cookies.set("next-auth.csrf-token", "", {
|
|
37
|
-
expires: new Date(0),
|
|
38
|
-
path: "/",
|
|
39
|
-
});
|
|
40
|
-
response.cookies.set("next-auth.callback-url", "", {
|
|
41
|
-
expires: new Date(0),
|
|
42
|
-
path: "/",
|
|
43
|
-
});
|
|
44
|
-
// Also clear secure cookie variants (used in production with HTTPS)
|
|
45
|
-
response.cookies.set("__Secure-next-auth.session-token", "", {
|
|
46
|
-
expires: new Date(0),
|
|
47
|
-
path: "/",
|
|
48
|
-
});
|
|
49
|
-
response.cookies.set("__Secure-next-auth.csrf-token", "", {
|
|
50
|
-
expires: new Date(0),
|
|
51
|
-
path: "/",
|
|
52
|
-
});
|
|
53
|
-
response.cookies.set("__Secure-next-auth.callback-url", "", {
|
|
54
|
-
expires: new Date(0),
|
|
55
|
-
path: "/",
|
|
56
|
-
});
|
|
57
|
-
// Host-prefixed variants (for some NextAuth configurations)
|
|
58
|
-
response.cookies.set("__Host-next-auth.csrf-token", "", {
|
|
59
|
-
expires: new Date(0),
|
|
60
|
-
path: "/",
|
|
61
|
-
});
|
|
25
|
+
clear_nextauth_cookies(response);
|
|
62
26
|
// Invalidate user cache
|
|
63
27
|
if (user_id) {
|
|
64
28
|
try {
|
package/dist/server-lib.d.ts
CHANGED
|
@@ -37,6 +37,8 @@ export type { RoleWithPermission } from "./lib/services/find_roles_with_permissi
|
|
|
37
37
|
export { authIssueTypeDef, registerAuthIssuePlugin } from "./admin-issues/plugin.server.js";
|
|
38
38
|
export { wireAdminIssueCapture } from "./admin-issues/wire.server.js";
|
|
39
39
|
export type { WireAdminIssueCaptureOptions } from "./admin-issues/wire.server";
|
|
40
|
+
export { installPermissionUX } from "./admin-issues/install_permission_ux.server.js";
|
|
41
|
+
export type { InstallPermissionUXOptions } from "./admin-issues/install_permission_ux.server";
|
|
40
42
|
export { denyPermission } from "./lib/auth/deny_permission.server.js";
|
|
41
43
|
export type { DenyPermissionInput } from "./lib/auth/deny_permission.server";
|
|
42
44
|
export { logOAuthPreflight, getOAuthPreflightReport } from "./lib/oauth_preflight.server.js";
|
package/dist/server-lib.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-lib.d.ts","sourceRoot":"","sources":["../src/server-lib.ts"],"names":[],"mappings":"AAYA,OAAO,aAAa,CAAC;AAGrB,cAAc,kBAAkB,CAAC;AAGjC,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AAGrF,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,mCAAmC,CAAC;AAG3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,gCAAgC,EAAE,MAA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AoB,EACpB,cAAc,EACd,eAAe,GAChB,MAAM,8BAA8B,CAAC"}
|
package/dist/server-lib.js
CHANGED
|
@@ -52,6 +52,7 @@ export { find_roles_with_permission } from "./lib/services/find_roles_with_permi
|
|
|
52
52
|
// admin-issues plugin (server)
|
|
53
53
|
export { authIssueTypeDef, registerAuthIssuePlugin } from "./admin-issues/plugin.server.js";
|
|
54
54
|
export { wireAdminIssueCapture } from "./admin-issues/wire.server.js";
|
|
55
|
+
export { installPermissionUX } from "./admin-issues/install_permission_ux.server.js";
|
|
55
56
|
// deny_permission helper
|
|
56
57
|
export { denyPermission } from "./lib/auth/deny_permission.server.js";
|
|
57
58
|
// section: oauth_preflight_exports
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"my_settings.d.ts","sourceRoot":"","sources":["../../src/server_pages/my_settings.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAQrB,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,SAAS,GACV,GAAE,mBAAwB,+
|
|
1
|
+
{"version":3,"file":"my_settings.d.ts","sourceRoot":"","sources":["../../src/server_pages/my_settings.tsx"],"names":[],"mappings":"AAEA,OAAO,aAAa,CAAC;AAQrB,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,SAAS,GACV,GAAE,mBAAwB,+BAiC1B;AAGD,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -56,7 +56,7 @@ export default function MySettingsPage({ className, } = {}) {
|
|
|
56
56
|
// Load configuration from INI file (with defaults)
|
|
57
57
|
const config = get_my_settings_config();
|
|
58
58
|
// Render layout with all server-initialized configuration, wrapped in AuthPageShell for navbar support
|
|
59
|
-
return (_jsx(AuthPageShell, { children: _jsx(MySettingsLayout, { className: className, password_requirements: config.passwordRequirements, profilePicture: config.profilePicture, userFields: config.userFields, unauthorizedMessage: config.unauthorizedMessage, loginButtonLabel: config.loginButtonLabel, loginPath: config.loginPath, heading: config.heading, subHeading: config.subHeading, profilePhotoLabel: config.profilePhotoLabel, profilePhotoRecommendation: config.profilePhotoRecommendation, uploadPhotoButtonLabel: config.uploadPhotoButtonLabel, removePhotoButtonLabel: config.removePhotoButtonLabel, profileInformationLabel: config.profileInformationLabel, passwordLabel: config.passwordLabel, currentPasswordLabel: config.currentPasswordLabel, newPasswordLabel: config.newPasswordLabel, confirmPasswordLabel: config.confirmPasswordLabel, messages: config.messages, uiSizes: config.uiSizes, fileTypes: config.fileTypes }) }));
|
|
59
|
+
return (_jsx(AuthPageShell, { children: _jsx(MySettingsLayout, { className: className, password_requirements: config.passwordRequirements, profilePicture: config.profilePicture, userFields: config.userFields, unauthorizedMessage: config.unauthorizedMessage, loginButtonLabel: config.loginButtonLabel, loginPath: config.loginPath, enableAccountDeletion: config.enableAccountDeletion, heading: config.heading, subHeading: config.subHeading, profilePhotoLabel: config.profilePhotoLabel, profilePhotoRecommendation: config.profilePhotoRecommendation, uploadPhotoButtonLabel: config.uploadPhotoButtonLabel, removePhotoButtonLabel: config.removePhotoButtonLabel, profileInformationLabel: config.profileInformationLabel, passwordLabel: config.passwordLabel, currentPasswordLabel: config.currentPasswordLabel, newPasswordLabel: config.newPasswordLabel, confirmPasswordLabel: config.confirmPasswordLabel, messages: config.messages, uiSizes: config.uiSizes, fileTypes: config.fileTypes }) }));
|
|
60
60
|
}
|
|
61
61
|
// Named export for direct imports
|
|
62
62
|
export { MySettingsPage };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hazo_auth",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.11.0",
|
|
4
4
|
"description": "Zero-config authentication UI components for Next.js with RBAC, OAuth, scope-based multi-tenancy, and invitations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"authentication",
|
|
@@ -41,6 +41,10 @@
|
|
|
41
41
|
"types": "./dist/client.d.ts",
|
|
42
42
|
"import": "./dist/client.js"
|
|
43
43
|
},
|
|
44
|
+
"./hooks": {
|
|
45
|
+
"types": "./dist/hooks.d.ts",
|
|
46
|
+
"import": "./dist/hooks.js"
|
|
47
|
+
},
|
|
44
48
|
"./server-lib": {
|
|
45
49
|
"types": "./dist/server-lib.d.ts",
|
|
46
50
|
"import": "./dist/server-lib.js"
|
|
@@ -262,18 +266,18 @@
|
|
|
262
266
|
"@radix-ui/react-switch": "^1.2.0",
|
|
263
267
|
"@radix-ui/react-tabs": "^1.1.0",
|
|
264
268
|
"@radix-ui/react-tooltip": "^1.2.0",
|
|
265
|
-
"hazo_api": "^2.
|
|
269
|
+
"hazo_api": "^2.6.0",
|
|
266
270
|
"hazo_config": "^2.4.1",
|
|
267
271
|
"hazo_connect": "^3.9.2",
|
|
268
|
-
"hazo_core": "^1.
|
|
272
|
+
"hazo_core": "^1.3.0",
|
|
269
273
|
"hazo_logs": "^2.1.1",
|
|
270
274
|
"hazo_notify": "^6.1.4",
|
|
271
|
-
"hazo_secure": "^1.
|
|
272
|
-
"hazo_theme": "^1.0.
|
|
273
|
-
"hazo_ui": "^6.
|
|
275
|
+
"hazo_secure": "^1.7.0",
|
|
276
|
+
"hazo_theme": "^1.0.1",
|
|
277
|
+
"hazo_ui": "^6.3.1",
|
|
274
278
|
"input-otp": "^1.4.0",
|
|
275
279
|
"lucide-react": "^0.553.0",
|
|
276
|
-
"next": "^14.0.0",
|
|
280
|
+
"next": "^14.0.0 || ^15.0.0 || ^16.0.0",
|
|
277
281
|
"next-auth": "^4.24.0",
|
|
278
282
|
"next-themes": "^0.4.0",
|
|
279
283
|
"react": "^18.0.0 || ^19.0.0",
|
|
@@ -406,14 +410,14 @@
|
|
|
406
410
|
"eslint": "^9.39.1",
|
|
407
411
|
"eslint-config-next": "^16.0.4",
|
|
408
412
|
"eslint-plugin-storybook": "^10.0.6",
|
|
409
|
-
"hazo_api": "^2.
|
|
413
|
+
"hazo_api": "^2.6.0",
|
|
410
414
|
"hazo_config": "^2.4.1",
|
|
411
415
|
"hazo_connect": "^3.9.2",
|
|
412
|
-
"hazo_core": "^1.
|
|
416
|
+
"hazo_core": "^1.3.0",
|
|
413
417
|
"hazo_logs": "^2.1.1",
|
|
414
418
|
"hazo_notify": "^6.1.4",
|
|
415
|
-
"hazo_theme": "^1.0.
|
|
416
|
-
"hazo_ui": "^6.
|
|
419
|
+
"hazo_theme": "^1.0.1",
|
|
420
|
+
"hazo_ui": "^6.3.1",
|
|
417
421
|
"input-otp": "^1.4.0",
|
|
418
422
|
"jest": "^30.2.0",
|
|
419
423
|
"jest-environment-jsdom": "^30.0.0",
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export type ForgotPasswordPageProps = {
|
|
2
|
-
alreadyLoggedInMessage?: string;
|
|
3
|
-
showLogoutButton?: boolean;
|
|
4
|
-
showReturnHomeButton?: boolean;
|
|
5
|
-
returnHomeButtonLabel?: string;
|
|
6
|
-
returnHomePath?: string;
|
|
7
|
-
imageSrc?: string;
|
|
8
|
-
imageAlt?: string;
|
|
9
|
-
imageBackgroundColor?: string;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Zero-config forgot password page component
|
|
13
|
-
* Uses sensible defaults and can be customized via props
|
|
14
|
-
* @param props - Optional configuration overrides
|
|
15
|
-
* @returns Forgot password page component
|
|
16
|
-
*/
|
|
17
|
-
export declare function ForgotPasswordPage({ alreadyLoggedInMessage, showLogoutButton, showReturnHomeButton, returnHomeButtonLabel, returnHomePath, imageSrc, imageAlt, imageBackgroundColor, }?: ForgotPasswordPageProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
export default ForgotPasswordPage;
|
|
19
|
-
//# sourceMappingURL=forgot_password.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"forgot_password.d.ts","sourceRoot":"","sources":["../../src/page_components/forgot_password.tsx"],"names":[],"mappings":"AA+BA,MAAM,MAAM,uBAAuB,GAAG;IACpC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAGF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,sBAAoD,EACpD,gBAAuB,EACvB,oBAA4B,EAC5B,qBAAqC,EACrC,cAAoB,EACpB,QAA4B,EAC5B,QAA4B,EAC5B,oBAAuC,GACxC,GAAE,uBAA4B,2CAmC9B;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// file_description: zero-config forgot password page component for hazo_auth
|
|
2
|
-
// Consumers can use this directly without needing to configure props
|
|
3
|
-
//
|
|
4
|
-
// ⚠️ DEPRECATED: This client component is deprecated in hazo_auth v2.0+
|
|
5
|
-
// Please use the new server component version instead:
|
|
6
|
-
//
|
|
7
|
-
// import { ForgotPasswordPage } from "hazo_auth/pages/forgot_password";
|
|
8
|
-
//
|
|
9
|
-
// The new version:
|
|
10
|
-
// - Initializes on the server (no loading state)
|
|
11
|
-
// - Works with your app's hazo_connect instance
|
|
12
|
-
// - True zero-config "drop in and use"
|
|
13
|
-
// - Better performance (smaller bundle)
|
|
14
|
-
//
|
|
15
|
-
// This file will be removed in v3.0
|
|
16
|
-
//
|
|
17
|
-
"use client";
|
|
18
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
|
-
// section: imports
|
|
20
|
-
import { useEffect, useState } from "react";
|
|
21
|
-
import forgot_password_layout from "../components/layouts/forgot_password/index.js";
|
|
22
|
-
import { createLayoutDataClient } from "../components/layouts/shared/data/layout_data_client.js";
|
|
23
|
-
import { create_sqlite_hazo_connect } from "../lib/hazo_connect_setup.js";
|
|
24
|
-
// section: constants
|
|
25
|
-
const DEFAULT_IMAGE_SRC = "/hazo_auth/images/forgot_password_default.jpg";
|
|
26
|
-
const DEFAULT_IMAGE_ALT = "Illustration of a globe representing secure authentication workflows";
|
|
27
|
-
const DEFAULT_IMAGE_BG = "#f1f5f9";
|
|
28
|
-
// section: component
|
|
29
|
-
/**
|
|
30
|
-
* Zero-config forgot password page component
|
|
31
|
-
* Uses sensible defaults and can be customized via props
|
|
32
|
-
* @param props - Optional configuration overrides
|
|
33
|
-
* @returns Forgot password page component
|
|
34
|
-
*/
|
|
35
|
-
export function ForgotPasswordPage({ alreadyLoggedInMessage = "You are already logged in", showLogoutButton = true, showReturnHomeButton = false, returnHomeButtonLabel = "Return home", returnHomePath = "/", imageSrc = DEFAULT_IMAGE_SRC, imageAlt = DEFAULT_IMAGE_ALT, imageBackgroundColor = DEFAULT_IMAGE_BG, } = {}) {
|
|
36
|
-
const [dataClient, setDataClient] = useState(null);
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
// Initialize hazo_connect on client side
|
|
39
|
-
const hazoConnect = create_sqlite_hazo_connect();
|
|
40
|
-
const client = createLayoutDataClient(hazoConnect);
|
|
41
|
-
setDataClient(client);
|
|
42
|
-
}, []);
|
|
43
|
-
// Show loading state while initializing
|
|
44
|
-
if (!dataClient) {
|
|
45
|
-
return (_jsx("div", { className: "cls_forgot_password_page_loading flex items-center justify-center min-h-screen", children: _jsx("div", { className: "text-slate-600 animate-pulse", children: "Loading..." }) }));
|
|
46
|
-
}
|
|
47
|
-
const ForgotPasswordLayout = forgot_password_layout;
|
|
48
|
-
return (_jsx(ForgotPasswordLayout, { image_src: imageSrc, image_alt: imageAlt, image_background_color: imageBackgroundColor, data_client: dataClient, alreadyLoggedInMessage: alreadyLoggedInMessage, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: returnHomeButtonLabel, returnHomePath: returnHomePath }));
|
|
49
|
-
}
|
|
50
|
-
export default ForgotPasswordPage;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @deprecated This client component is deprecated in hazo_auth v2.0+
|
|
3
|
-
* Use the new server component version instead: `import { LoginPage } from "hazo_auth/pages/login"`
|
|
4
|
-
*/
|
|
5
|
-
export type LoginPageProps = {
|
|
6
|
-
redirectRoute?: string;
|
|
7
|
-
successMessage?: string;
|
|
8
|
-
alreadyLoggedInMessage?: string;
|
|
9
|
-
showLogoutButton?: boolean;
|
|
10
|
-
showReturnHomeButton?: boolean;
|
|
11
|
-
returnHomeButtonLabel?: string;
|
|
12
|
-
returnHomePath?: string;
|
|
13
|
-
forgotPasswordPath?: string;
|
|
14
|
-
forgotPasswordLabel?: string;
|
|
15
|
-
createAccountPath?: string;
|
|
16
|
-
createAccountLabel?: string;
|
|
17
|
-
urlOnLogon?: string;
|
|
18
|
-
imageSrc?: string;
|
|
19
|
-
imageAlt?: string;
|
|
20
|
-
imageBackgroundColor?: string;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Zero-config login page component
|
|
24
|
-
* Uses sensible defaults and can be customized via props
|
|
25
|
-
* @param props - Optional configuration overrides
|
|
26
|
-
* @returns Login page component
|
|
27
|
-
*/
|
|
28
|
-
export declare function LoginPage({ redirectRoute, successMessage, alreadyLoggedInMessage, showLogoutButton, showReturnHomeButton, returnHomeButtonLabel, returnHomePath, forgotPasswordPath, forgotPasswordLabel, createAccountPath, createAccountLabel, urlOnLogon, imageSrc, imageAlt, imageBackgroundColor, }?: LoginPageProps): import("react/jsx-runtime").JSX.Element;
|
|
29
|
-
export default LoginPage;
|
|
30
|
-
//# sourceMappingURL=login.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/page_components/login.tsx"],"names":[],"mappings":"AA+BA;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAGF;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,EACxB,aAAa,EACb,cAAyC,EACzC,sBAAoD,EACpD,gBAAuB,EACvB,oBAA4B,EAC5B,qBAAqC,EACrC,cAAoB,EACpB,kBAAiD,EACjD,mBAAwC,EACxC,iBAAyC,EACzC,kBAAqC,EACrC,UAAU,EACV,QAA4B,EAC5B,QAA4B,EAC5B,oBAAuC,GACxC,GAAE,cAAmB,2CA0CrB;AAED,eAAe,SAAS,CAAC"}
|