hazo_auth 10.18.3 → 10.19.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/cli-src/lib/utils/password_validator.ts +12 -5
- package/dist/components/layouts/email_verification/config/email_verification_field_config.d.ts.map +1 -1
- package/dist/components/layouts/email_verification/config/email_verification_field_config.js +18 -15
- 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 +12 -9
- package/dist/components/layouts/email_verification/index.d.ts.map +1 -1
- package/dist/components/layouts/email_verification/index.js +6 -3
- package/dist/components/layouts/forgot_password/config/forgot_password_field_config.d.ts.map +1 -1
- package/dist/components/layouts/forgot_password/config/forgot_password_field_config.js +11 -8
- 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 +8 -5
- package/dist/components/layouts/forgot_password/index.d.ts.map +1 -1
- package/dist/components/layouts/forgot_password/index.js +6 -3
- package/dist/components/layouts/login/config/login_field_config.d.ts.map +1 -1
- package/dist/components/layouts/login/config/login_field_config.js +14 -11
- package/dist/components/layouts/login/hooks/use_login_form.d.ts.map +1 -1
- package/dist/components/layouts/login/hooks/use_login_form.js +7 -4
- package/dist/components/layouts/login/index.d.ts.map +1 -1
- package/dist/components/layouts/login/index.js +11 -8
- package/dist/components/layouts/my_settings/components/connected_accounts_section.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/components/connected_accounts_section.js +7 -4
- package/dist/components/layouts/my_settings/components/danger_zone_section.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/components/danger_zone_section.js +8 -5
- package/dist/components/layouts/my_settings/components/set_password_section.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/components/set_password_section.js +20 -13
- package/dist/components/layouts/my_settings/config/my_settings_field_config.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/config/my_settings_field_config.js +9 -6
- package/dist/components/layouts/otp/index.d.ts.map +1 -1
- package/dist/components/layouts/otp/index.js +4 -1
- package/dist/components/layouts/register/config/register_field_config.d.ts.map +1 -1
- package/dist/components/layouts/register/config/register_field_config.js +20 -17
- package/dist/components/layouts/register/hooks/use_register_form.d.ts.map +1 -1
- package/dist/components/layouts/register/hooks/use_register_form.js +8 -5
- package/dist/components/layouts/register/index.d.ts.map +1 -1
- package/dist/components/layouts/register/index.js +11 -8
- package/dist/components/layouts/reset_password/config/reset_password_field_config.d.ts +1 -1
- package/dist/components/layouts/reset_password/config/reset_password_field_config.d.ts.map +1 -1
- package/dist/components/layouts/reset_password/config/reset_password_field_config.js +14 -11
- 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 +13 -10
- package/dist/components/layouts/reset_password/index.d.ts.map +1 -1
- package/dist/components/layouts/reset_password/index.js +7 -4
- package/dist/components/layouts/shared/components/already_logged_in_guard.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/already_logged_in_guard.js +4 -1
- package/dist/components/layouts/shared/components/facebook_sign_in_button.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/facebook_sign_in_button.js +5 -2
- package/dist/components/layouts/shared/components/form_action_buttons.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/form_action_buttons.js +4 -1
- package/dist/components/layouts/shared/components/google_sign_in_button.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/google_sign_in_button.js +5 -2
- package/dist/components/layouts/shared/components/logout_button.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/logout_button.js +7 -4
- package/dist/components/layouts/shared/components/oauth_divider.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/oauth_divider.js +4 -1
- package/dist/components/layouts/shared/components/password_field.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/password_field.js +4 -1
- package/dist/components/layouts/shared/components/unauthorized_guard.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/unauthorized_guard.js +6 -3
- package/dist/components/layouts/shared/config/layout_customization.d.ts +5 -0
- package/dist/components/layouts/shared/config/layout_customization.d.ts.map +1 -1
- package/dist/components/layouts/shared/config/layout_customization.js +14 -0
- package/dist/components/layouts/shared/utils/validation.d.ts +4 -0
- package/dist/components/layouts/shared/utils/validation.d.ts.map +1 -1
- package/dist/components/layouts/shared/utils/validation.js +18 -6
- package/dist/components/layouts/user_management/components/roles_matrix.d.ts.map +1 -1
- package/dist/components/layouts/user_management/components/roles_matrix.js +22 -17
- package/dist/components/layouts/user_management/components/scope_hierarchy_tab.d.ts.map +1 -1
- package/dist/components/layouts/user_management/components/scope_hierarchy_tab.js +29 -26
- package/dist/components/layouts/user_management/components/user_scopes_tab.d.ts.map +1 -1
- package/dist/components/layouts/user_management/components/user_scopes_tab.js +27 -19
- package/dist/components/layouts/user_management/components/user_signup_stats_cards.d.ts +2 -1
- package/dist/components/layouts/user_management/components/user_signup_stats_cards.d.ts.map +1 -1
- package/dist/components/layouts/user_management/components/user_signup_stats_cards.js +64 -21
- package/dist/components/layouts/user_management/index.d.ts.map +1 -1
- package/dist/components/layouts/user_management/index.js +48 -42
- package/dist/components/otp/OTPRequestForm.d.ts.map +1 -1
- package/dist/components/otp/OTPRequestForm.js +8 -5
- package/dist/components/otp/OTPVerifyForm.d.ts.map +1 -1
- package/dist/components/otp/OTPVerifyForm.js +10 -7
- package/dist/components/permission_denied_dialog.client.d.ts.map +1 -1
- package/dist/components/permission_denied_dialog.client.js +12 -9
- package/dist/lib/utils/password_validator.d.ts.map +1 -1
- package/dist/lib/utils/password_validator.js +5 -5
- package/dist/locales/en.json +383 -0
- package/dist/server/routes/library_photos.d.ts +2 -2
- package/dist/server/routes/set_password.js +1 -1
- package/dist/strings/default_strings.d.ts.map +1 -1
- package/dist/strings/default_strings.js +14 -11
- package/package.json +22 -17
|
@@ -6,6 +6,9 @@ import { toast } from "sonner";
|
|
|
6
6
|
import { RESET_PASSWORD_FIELD_IDS } from "../config/reset_password_field_config.js";
|
|
7
7
|
import { validatePassword } from "../../shared/utils/validation.js";
|
|
8
8
|
import { useHazoAuthConfig } from "../../../../contexts/hazo_auth_provider.js";
|
|
9
|
+
import en from "../../../../locales/en.json" with { type: "json" };
|
|
10
|
+
import { createPackageT } from "hazo_core/i18n";
|
|
11
|
+
const t = createPackageT("hazo_auth", en);
|
|
9
12
|
// section: constants
|
|
10
13
|
const PASSWORD_FIELDS = [
|
|
11
14
|
RESET_PASSWORD_FIELD_IDS.PASSWORD,
|
|
@@ -36,7 +39,7 @@ export const use_reset_password_form = ({ passwordRequirements, dataClient, logi
|
|
|
36
39
|
// Validate token on mount
|
|
37
40
|
useEffect(() => {
|
|
38
41
|
if (!tokenParam) {
|
|
39
|
-
setTokenError("
|
|
42
|
+
setTokenError(t("reset_password.link_invalid_message"));
|
|
40
43
|
return;
|
|
41
44
|
}
|
|
42
45
|
// Validate token by calling validation API
|
|
@@ -49,7 +52,7 @@ export const use_reset_password_form = ({ passwordRequirements, dataClient, logi
|
|
|
49
52
|
});
|
|
50
53
|
const data = await response.json();
|
|
51
54
|
if (!response.ok || !data.success) {
|
|
52
|
-
const errorMessage = data.error || "
|
|
55
|
+
const errorMessage = data.error || t("reset_password.link_invalid_message");
|
|
53
56
|
setTokenError(errorMessage);
|
|
54
57
|
setToken(null);
|
|
55
58
|
}
|
|
@@ -61,7 +64,7 @@ export const use_reset_password_form = ({ passwordRequirements, dataClient, logi
|
|
|
61
64
|
}
|
|
62
65
|
catch (error) {
|
|
63
66
|
const errorMessage = error instanceof Error ? error.message : "An error occurred while validating the token";
|
|
64
|
-
setTokenError("
|
|
67
|
+
setTokenError(t("reset_password.link_invalid_message"));
|
|
65
68
|
setToken(null);
|
|
66
69
|
}
|
|
67
70
|
finally {
|
|
@@ -106,7 +109,7 @@ export const use_reset_password_form = ({ passwordRequirements, dataClient, logi
|
|
|
106
109
|
// Also validate confirm password if it has a value
|
|
107
110
|
if (values[RESET_PASSWORD_FIELD_IDS.CONFIRM_PASSWORD]) {
|
|
108
111
|
if (value !== values[RESET_PASSWORD_FIELD_IDS.CONFIRM_PASSWORD]) {
|
|
109
|
-
setErrors((prev) => (Object.assign(Object.assign({}, prev), { [RESET_PASSWORD_FIELD_IDS.CONFIRM_PASSWORD]: "
|
|
112
|
+
setErrors((prev) => (Object.assign(Object.assign({}, prev), { [RESET_PASSWORD_FIELD_IDS.CONFIRM_PASSWORD]: t("validation.passwords_do_not_match") })));
|
|
110
113
|
}
|
|
111
114
|
else {
|
|
112
115
|
setErrors((prev) => {
|
|
@@ -119,7 +122,7 @@ export const use_reset_password_form = ({ passwordRequirements, dataClient, logi
|
|
|
119
122
|
}
|
|
120
123
|
else if (fieldId === RESET_PASSWORD_FIELD_IDS.CONFIRM_PASSWORD) {
|
|
121
124
|
if (value !== values[RESET_PASSWORD_FIELD_IDS.PASSWORD]) {
|
|
122
|
-
setErrors((prev) => (Object.assign(Object.assign({}, prev), { [RESET_PASSWORD_FIELD_IDS.CONFIRM_PASSWORD]: "
|
|
125
|
+
setErrors((prev) => (Object.assign(Object.assign({}, prev), { [RESET_PASSWORD_FIELD_IDS.CONFIRM_PASSWORD]: t("validation.passwords_do_not_match") })));
|
|
123
126
|
}
|
|
124
127
|
else {
|
|
125
128
|
setErrors((prev) => {
|
|
@@ -136,13 +139,13 @@ export const use_reset_password_form = ({ passwordRequirements, dataClient, logi
|
|
|
136
139
|
const handleSubmit = useCallback(async (event) => {
|
|
137
140
|
event.preventDefault();
|
|
138
141
|
if (!token) {
|
|
139
|
-
toast.error("
|
|
142
|
+
toast.error(t("reset_password.token_missing"));
|
|
140
143
|
return;
|
|
141
144
|
}
|
|
142
145
|
// Validate all fields
|
|
143
146
|
const passwordError = validatePassword(values[RESET_PASSWORD_FIELD_IDS.PASSWORD], passwordRequirements);
|
|
144
147
|
const confirmPasswordError = values[RESET_PASSWORD_FIELD_IDS.PASSWORD] !== values[RESET_PASSWORD_FIELD_IDS.CONFIRM_PASSWORD]
|
|
145
|
-
? "
|
|
148
|
+
? t("validation.passwords_do_not_match")
|
|
146
149
|
: undefined;
|
|
147
150
|
if (passwordError || confirmPasswordError) {
|
|
148
151
|
setErrors(Object.assign(Object.assign({}, (passwordError ? { [RESET_PASSWORD_FIELD_IDS.PASSWORD]: passwordError } : {})), (confirmPasswordError ? { [RESET_PASSWORD_FIELD_IDS.CONFIRM_PASSWORD]: confirmPasswordError } : {})));
|
|
@@ -162,13 +165,13 @@ export const use_reset_password_form = ({ passwordRequirements, dataClient, logi
|
|
|
162
165
|
});
|
|
163
166
|
const data = await response.json();
|
|
164
167
|
if (!response.ok || !data.success) {
|
|
165
|
-
const errorMessage = data.error || "
|
|
168
|
+
const errorMessage = data.error || t("reset_password.failed_message");
|
|
166
169
|
toast.error(errorMessage);
|
|
167
170
|
setTokenError(errorMessage);
|
|
168
171
|
setIsSubmitting(false);
|
|
169
172
|
return;
|
|
170
173
|
}
|
|
171
|
-
toast.success(data.message || "
|
|
174
|
+
toast.success(data.message || t("reset_password.success_toast"));
|
|
172
175
|
setIsSuccess(true);
|
|
173
176
|
// Redirect to login after a short delay
|
|
174
177
|
setTimeout(() => {
|
|
@@ -176,7 +179,7 @@ export const use_reset_password_form = ({ passwordRequirements, dataClient, logi
|
|
|
176
179
|
}, 2000);
|
|
177
180
|
}
|
|
178
181
|
catch (error) {
|
|
179
|
-
const errorMessage = error instanceof Error ? error.message : "
|
|
182
|
+
const errorMessage = error instanceof Error ? error.message : t("shared.generic_error");
|
|
180
183
|
toast.error(errorMessage);
|
|
181
184
|
setTokenError(errorMessage);
|
|
182
185
|
setIsSubmitting(false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/reset_password/index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAOlD,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,4BAA4B,EAClC,MAAM,uCAAuC,CAAC;AAY/C,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/reset_password/index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAOlD,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,4BAA4B,EAClC,MAAM,uCAAuC,CAAC;AAY/C,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAQ1E,MAAM,MAAM,wBAAwB,CAAC,OAAO,GAAG,OAAO,IAAI;IACxD,SAAS,EAAE,MAAM,GAAG,eAAe,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,eAAe,CAAC,EAAE,uBAAuB,CAAC;IAC1C,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,aAAa,CAAC,EAAE,sBAAsB,CAAC;IACvC,qBAAqB,CAAC,EAAE,4BAA4B,CAAC;IACrD,WAAW,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACvC,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,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAUF,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,OAAO,EAAE,EACrD,SAAS,EACT,SAAS,EACT,sBAAkC,EAClC,eAAe,EACf,MAAM,EACN,aAAa,EACb,qBAAqB,EACrB,WAAW,EACX,sBAAsB,EACtB,gBAAuB,EACvB,oBAA4B,EAC5B,qBAA6D,EAC7D,cAAoB,EACpB,YAAuD,EACvD,cAA4D,EAC5D,SAA8B,EAC9B,kBAAiD,GAClD,EAAE,wBAAwB,CAAC,OAAO,CAAC,+BAqNnC"}
|
|
@@ -13,12 +13,15 @@ import { AlreadyLoggedInGuard } from "../shared/components/already_logged_in_gua
|
|
|
13
13
|
import { RESET_PASSWORD_FIELD_IDS, createResetPasswordFieldDefinitions, resolveResetPasswordButtonPalette, resolveResetPasswordLabels, resolveResetPasswordPasswordRequirements, } from "./config/reset_password_field_config.js";
|
|
14
14
|
import { use_reset_password_form, } from "./hooks/use_reset_password_form.js";
|
|
15
15
|
import Link from "next/link";
|
|
16
|
+
import en from "../../../locales/en.json" with { type: "json" };
|
|
17
|
+
import { createPackageT } from "hazo_core/i18n";
|
|
18
|
+
const t = createPackageT("hazo_auth", en);
|
|
16
19
|
const ORDERED_FIELDS = [
|
|
17
20
|
RESET_PASSWORD_FIELD_IDS.PASSWORD,
|
|
18
21
|
RESET_PASSWORD_FIELD_IDS.CONFIRM_PASSWORD,
|
|
19
22
|
];
|
|
20
23
|
// section: component
|
|
21
|
-
export default function reset_password_layout({ image_src, image_alt, image_background_color = "#f1f5f9", field_overrides, labels, button_colors, password_requirements, data_client, alreadyLoggedInMessage, showLogoutButton = true, showReturnHomeButton = false, returnHomeButtonLabel = "
|
|
24
|
+
export default function reset_password_layout({ image_src, image_alt, image_background_color = "#f1f5f9", field_overrides, labels, button_colors, password_requirements, data_client, alreadyLoggedInMessage, showLogoutButton = true, showReturnHomeButton = false, returnHomeButtonLabel = t("shared.guard.return_home_default"), returnHomePath = "/", errorMessage = t("reset_password.link_invalid_message"), successMessage = t("reset_password.success_message_default"), loginPath = "/hazo_auth/login", forgotPasswordPath = "/hazo_auth/forgot_password", }) {
|
|
22
25
|
const fieldDefinitions = createResetPasswordFieldDefinitions(field_overrides);
|
|
23
26
|
const resolvedLabels = resolveResetPasswordLabels(labels);
|
|
24
27
|
const resolvedButtonPalette = resolveResetPasswordButtonPalette(button_colors);
|
|
@@ -43,11 +46,11 @@ export default function reset_password_layout({ image_src, image_alt, image_back
|
|
|
43
46
|
}
|
|
44
47
|
// Show loading state while validating token
|
|
45
48
|
if (form.isValidatingToken) {
|
|
46
|
-
return (_jsx(AlreadyLoggedInGuard, { image_src: image_src, image_alt: image_alt, image_background_color: image_background_color, message: alreadyLoggedInMessage, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: returnHomeButtonLabel, returnHomePath: returnHomePath, children: _jsx(TwoColumnAuthLayout, { imageSrc: image_src, imageAlt: image_alt, imageBackgroundColor: image_background_color, formContent: _jsxs("div", { className: "cls_reset_password_layout_validating flex flex-col items-center justify-center gap-4 py-8", children: [_jsx(Loader2, { className: "h-12 w-12 animate-spin text-slate-600", "aria-hidden": "true" }), _jsxs("div", { className: "cls_reset_password_layout_validating_text text-center", children: [_jsx("h1", { className: "cls_reset_password_layout_validating_heading text-2xl font-semibold text-slate-900", children: resolvedLabels.heading }), _jsx("p", { className: "cls_reset_password_layout_validating_subheading mt-2 text-sm text-slate-600", children: "
|
|
49
|
+
return (_jsx(AlreadyLoggedInGuard, { image_src: image_src, image_alt: image_alt, image_background_color: image_background_color, message: alreadyLoggedInMessage, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: returnHomeButtonLabel, returnHomePath: returnHomePath, children: _jsx(TwoColumnAuthLayout, { imageSrc: image_src, imageAlt: image_alt, imageBackgroundColor: image_background_color, formContent: _jsxs("div", { className: "cls_reset_password_layout_validating flex flex-col items-center justify-center gap-4 py-8", children: [_jsx(Loader2, { className: "h-12 w-12 animate-spin text-slate-600", "aria-hidden": "true" }), _jsxs("div", { className: "cls_reset_password_layout_validating_text text-center", children: [_jsx("h1", { className: "cls_reset_password_layout_validating_heading text-2xl font-semibold text-slate-900", children: resolvedLabels.heading }), _jsx("p", { className: "cls_reset_password_layout_validating_subheading mt-2 text-sm text-slate-600", children: t("reset_password.validating_message") })] })] }) }) }));
|
|
47
50
|
}
|
|
48
51
|
// Show error message if token is invalid or missing
|
|
49
52
|
if (form.tokenError || !form.token) {
|
|
50
|
-
return (_jsx(AlreadyLoggedInGuard, { image_src: image_src, image_alt: image_alt, image_background_color: image_background_color, message: alreadyLoggedInMessage, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: returnHomeButtonLabel, returnHomePath: returnHomePath, children: _jsx(TwoColumnAuthLayout, { imageSrc: image_src, imageAlt: image_alt, imageBackgroundColor: image_background_color, formContent: _jsxs("div", { className: "cls_reset_password_layout_error flex flex-col items-center justify-center gap-4 p-8 text-center", children: [_jsx(XCircle, { className: "cls_reset_password_layout_error_icon h-16 w-16 text-red-600", "aria-hidden": "true" }), _jsxs("div", { className: "cls_reset_password_layout_error_text", children: [_jsx("h1", { className: "cls_reset_password_layout_error_heading text-2xl font-semibold text-slate-900", children: "
|
|
53
|
+
return (_jsx(AlreadyLoggedInGuard, { image_src: image_src, image_alt: image_alt, image_background_color: image_background_color, message: alreadyLoggedInMessage, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: returnHomeButtonLabel, returnHomePath: returnHomePath, children: _jsx(TwoColumnAuthLayout, { imageSrc: image_src, imageAlt: image_alt, imageBackgroundColor: image_background_color, formContent: _jsxs("div", { className: "cls_reset_password_layout_error flex flex-col items-center justify-center gap-4 p-8 text-center", children: [_jsx(XCircle, { className: "cls_reset_password_layout_error_icon h-16 w-16 text-red-600", "aria-hidden": "true" }), _jsxs("div", { className: "cls_reset_password_layout_error_text", children: [_jsx("h1", { className: "cls_reset_password_layout_error_heading text-2xl font-semibold text-slate-900", children: t("reset_password.invalid_link_heading") }), _jsx("p", { className: "cls_reset_password_layout_error_message mt-2 text-sm text-slate-600", children: form.tokenError || errorMessage })] }), _jsx(Link, { href: forgotPasswordPath, className: "cls_reset_password_layout_forgot_password_link mt-4 text-sm text-blue-600 hover:text-blue-800 underline", children: t("reset_password.invalid_link_page_link") })] }) }) }));
|
|
51
54
|
}
|
|
52
|
-
return (_jsx(AlreadyLoggedInGuard, { image_src: image_src, image_alt: image_alt, image_background_color: image_background_color, message: alreadyLoggedInMessage, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: returnHomeButtonLabel, returnHomePath: returnHomePath, children: _jsx(TwoColumnAuthLayout, { imageSrc: image_src, imageAlt: image_alt, imageBackgroundColor: image_background_color, formContent: _jsxs(_Fragment, { children: [_jsx(FormHeader, { heading: resolvedLabels.heading, subHeading: resolvedLabels.subHeading }), _jsxs("form", { className: "cls_reset_password_layout_form_fields flex flex-col gap-5", onSubmit: form.handleSubmit, "aria-label": "
|
|
55
|
+
return (_jsx(AlreadyLoggedInGuard, { image_src: image_src, image_alt: image_alt, image_background_color: image_background_color, message: alreadyLoggedInMessage, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: returnHomeButtonLabel, returnHomePath: returnHomePath, children: _jsx(TwoColumnAuthLayout, { imageSrc: image_src, imageAlt: image_alt, imageBackgroundColor: image_background_color, formContent: _jsxs(_Fragment, { children: [_jsx(FormHeader, { heading: resolvedLabels.heading, subHeading: resolvedLabels.subHeading }), _jsxs("form", { className: "cls_reset_password_layout_form_fields flex flex-col gap-5", onSubmit: form.handleSubmit, "aria-label": t("reset_password.aria.form"), children: [renderFields(form), _jsx(FormActionButtons, { submitLabel: resolvedLabels.submitButton, cancelLabel: resolvedLabels.cancelButton, buttonPalette: resolvedButtonPalette, isSubmitDisabled: form.isSubmitDisabled, onCancel: form.handleCancel, submitAriaLabel: t("reset_password.aria.submit"), cancelAriaLabel: t("reset_password.aria.cancel") }), form.isSubmitting && (_jsx("div", { className: "cls_reset_password_layout_submitting_indicator text-sm text-slate-600 text-center", children: t("reset_password.submitting_indicator") }))] })] }) }) }));
|
|
53
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"already_logged_in_guard.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/already_logged_in_guard.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"already_logged_in_guard.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/already_logged_in_guard.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAOlD,MAAM,MAAM,yBAAyB,GAAG;IACtC,SAAS,EAAE,MAAM,GAAG,eAAe,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,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,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAGF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,SAAS,EACT,SAAS,EACT,sBAAkC,EAClC,OAAqD,EACrD,gBAAuB,EACvB,oBAA4B,EAC5B,qBAA6D,EAC7D,cAAoB,EACpB,oBAA4B,EAC5B,QAAQ,GACT,EAAE,yBAAyB,+BAiD3B"}
|
|
@@ -9,6 +9,9 @@ import { Button } from "../../../ui/button.js";
|
|
|
9
9
|
import { TwoColumnAuthLayout } from "./two_column_auth_layout.js";
|
|
10
10
|
import { useRouter } from "next/navigation";
|
|
11
11
|
import { Home } from "lucide-react";
|
|
12
|
+
import en from "../../../../locales/en.json" with { type: "json" };
|
|
13
|
+
import { createPackageT } from "hazo_core/i18n";
|
|
14
|
+
const t = createPackageT("hazo_auth", en);
|
|
12
15
|
// section: component
|
|
13
16
|
/**
|
|
14
17
|
* Guard component that shows "already logged in" message if user is authenticated
|
|
@@ -16,7 +19,7 @@ import { Home } from "lucide-react";
|
|
|
16
19
|
* @param props - Component props including layout config and message customization
|
|
17
20
|
* @returns Either the "already logged in" UI or the children
|
|
18
21
|
*/
|
|
19
|
-
export function AlreadyLoggedInGuard({ image_src, image_alt, image_background_color = "#f1f5f9", message = "
|
|
22
|
+
export function AlreadyLoggedInGuard({ image_src, image_alt, image_background_color = "#f1f5f9", message = t("shared.guard.already_logged_in_message"), showLogoutButton = true, showReturnHomeButton = false, returnHomeButtonLabel = t("shared.guard.return_home_default"), returnHomePath = "/", requireEmailVerified = false, children, }) {
|
|
20
23
|
const router = useRouter();
|
|
21
24
|
const authStatus = use_auth_status();
|
|
22
25
|
// Check if user should see "already logged in" message
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"facebook_sign_in_button.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/facebook_sign_in_button.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"facebook_sign_in_button.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/facebook_sign_in_button.tsx"],"names":[],"mappings":"AAyBA,MAAM,MAAM,yBAAyB,GAAG;IACtC,mCAAmC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iFAAiF;IACjF,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAGF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,KAAiD,EACjD,OAAO,EACP,QAAgB,EAChB,SAAS,EACT,WAAsD,GACvD,EAAE,yBAAyB,+BA6C3B;AAED,eAAe,oBAAoB,CAAC"}
|
|
@@ -8,6 +8,9 @@ import { cn } from "../../../../lib/utils.js";
|
|
|
8
8
|
import { useState } from "react";
|
|
9
9
|
import { Loader2 } from "lucide-react";
|
|
10
10
|
import { signIn } from "next-auth/react";
|
|
11
|
+
import en from "../../../../locales/en.json" with { type: "json" };
|
|
12
|
+
import { createPackageT } from "hazo_core/i18n";
|
|
13
|
+
const t = createPackageT("hazo_auth", en);
|
|
11
14
|
// Facebook "f" icon as inline SVG (no external dep)
|
|
12
15
|
function FacebookIcon({ className }) {
|
|
13
16
|
return (_jsx("svg", { className: cn("h-5 w-5", className), viewBox: "0 0 24 24", fill: "#1877F2", "aria-hidden": "true", children: _jsx("path", { d: "M24 12.073C24 5.404 18.627 0 12 0S0 5.404 0 12.073C0 18.1 4.388 23.094 10.125 24v-8.437H7.078v-3.49h3.047V9.413c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.49h-2.796V24C19.612 23.094 24 18.1 24 12.073z" }) }));
|
|
@@ -19,7 +22,7 @@ function FacebookIcon({ className }) {
|
|
|
19
22
|
* Initiates the Facebook OAuth flow when clicked
|
|
20
23
|
* Uses next-auth/react signIn function for proper OAuth flow
|
|
21
24
|
*/
|
|
22
|
-
export function FacebookSignInButton({ label = "
|
|
25
|
+
export function FacebookSignInButton({ label = t("shared.oauth.facebook_button_default"), onClick, disabled = false, className, callbackUrl = "/api/hazo_auth/oauth/facebook/callback", }) {
|
|
23
26
|
const [isLoading, setIsLoading] = useState(false);
|
|
24
27
|
const handleClick = async () => {
|
|
25
28
|
if (disabled || isLoading)
|
|
@@ -42,6 +45,6 @@ export function FacebookSignInButton({ label = "Continue with Facebook", onClick
|
|
|
42
45
|
}
|
|
43
46
|
}
|
|
44
47
|
};
|
|
45
|
-
return (_jsxs(Button, { type: "button", variant: "outline", onClick: handleClick, disabled: disabled || isLoading, className: cn("cls_facebook_sign_in_button w-full flex items-center justify-center gap-3 h-11 border-slate-300 hover:bg-slate-50 hover:border-slate-400 transition-colors", className), "aria-label": label, children: [isLoading ? (_jsx(Loader2, { className: "h-5 w-5 animate-spin text-slate-600", "aria-hidden": "true" })) : (_jsx(FacebookIcon, { className: "h-5 w-5" })), _jsx("span", { className: "text-slate-700 font-medium", children: isLoading ? "
|
|
48
|
+
return (_jsxs(Button, { type: "button", variant: "outline", onClick: handleClick, disabled: disabled || isLoading, className: cn("cls_facebook_sign_in_button w-full flex items-center justify-center gap-3 h-11 border-slate-300 hover:bg-slate-50 hover:border-slate-400 transition-colors", className), "aria-label": label, children: [isLoading ? (_jsx(Loader2, { className: "h-5 w-5 animate-spin text-slate-600", "aria-hidden": "true" })) : (_jsx(FacebookIcon, { className: "h-5 w-5" })), _jsx("span", { className: "text-slate-700 font-medium", children: isLoading ? t("shared.oauth.signing_in") : label })] }));
|
|
46
49
|
}
|
|
47
50
|
export default FacebookSignInButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form_action_buttons.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/form_action_buttons.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"form_action_buttons.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/form_action_buttons.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAO5E,KAAK,sBAAsB,GAAG;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,qBAAqB,CAAC;IACrC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAGF,wBAAgB,iBAAiB,CAAC,EAChC,WAAW,EACX,WAAuC,EACvC,aAAa,EACb,gBAAgB,EAChB,QAAQ,EACR,eAA6D,EAC7D,eAA6D,EAC7D,SAAS,EACT,UAAkB,GACnB,EAAE,sBAAsB,+BAoCxB"}
|
|
@@ -3,8 +3,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
// section: imports
|
|
4
4
|
import { CircleCheckBig, CircleX } from "lucide-react";
|
|
5
5
|
import { Button } from "../../../ui/button.js";
|
|
6
|
+
import en from "../../../../locales/en.json" with { type: "json" };
|
|
7
|
+
import { createPackageT } from "hazo_core/i18n";
|
|
8
|
+
const t = createPackageT("hazo_auth", en);
|
|
6
9
|
// section: component
|
|
7
|
-
export function FormActionButtons({ submitLabel, cancelLabel = "
|
|
10
|
+
export function FormActionButtons({ submitLabel, cancelLabel = t("shared.cancel_button"), buttonPalette, isSubmitDisabled, onCancel, submitAriaLabel = t("shared.form_action.submit_aria_default"), cancelAriaLabel = t("shared.form_action.cancel_aria_default"), className, hideCancel = false, }) {
|
|
8
11
|
return (_jsxs("div", { className: `cls_form_action_buttons mt-2 flex flex-wrap items-center justify-end gap-4 ${className !== null && className !== void 0 ? className : ""}`, children: [_jsxs(Button, { type: "submit", disabled: isSubmitDisabled, className: "cls_form_action_submit_button flex shrink-0 items-center gap-2", "aria-label": submitAriaLabel, style: {
|
|
9
12
|
backgroundColor: buttonPalette.submitBackground,
|
|
10
13
|
color: buttonPalette.submitText,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google_sign_in_button.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/google_sign_in_button.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"google_sign_in_button.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/google_sign_in_button.tsx"],"names":[],"mappings":"AAiBA,MAAM,MAAM,uBAAuB,GAAG;IACpC,mCAAmC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+EAA+E;IAC/E,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAGF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,KAA+C,EAC/C,OAAO,EACP,QAAgB,EAChB,SAAS,EACT,WAAoD,GACrD,EAAE,uBAAuB,+BAmDzB;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -9,6 +9,9 @@ import { cn } from "../../../../lib/utils.js";
|
|
|
9
9
|
import { useState } from "react";
|
|
10
10
|
import { Loader2 } from "lucide-react";
|
|
11
11
|
import { signIn } from "next-auth/react";
|
|
12
|
+
import en from "../../../../locales/en.json" with { type: "json" };
|
|
13
|
+
import { createPackageT } from "hazo_core/i18n";
|
|
14
|
+
const t = createPackageT("hazo_auth", en);
|
|
12
15
|
// section: component
|
|
13
16
|
/**
|
|
14
17
|
* Google Sign-In button component
|
|
@@ -16,7 +19,7 @@ import { signIn } from "next-auth/react";
|
|
|
16
19
|
* Initiates the Google OAuth flow when clicked
|
|
17
20
|
* Uses next-auth/react signIn function for proper OAuth flow
|
|
18
21
|
*/
|
|
19
|
-
export function GoogleSignInButton({ label = "
|
|
22
|
+
export function GoogleSignInButton({ label = t("shared.oauth.google_button_default"), onClick, disabled = false, className, callbackUrl = "/api/hazo_auth/oauth/google/callback", }) {
|
|
20
23
|
const [isLoading, setIsLoading] = useState(false);
|
|
21
24
|
const handleClick = async () => {
|
|
22
25
|
if (disabled || isLoading)
|
|
@@ -45,6 +48,6 @@ export function GoogleSignInButton({ label = "Continue with Google", onClick, di
|
|
|
45
48
|
}
|
|
46
49
|
}
|
|
47
50
|
};
|
|
48
|
-
return (_jsxs(Button, { type: "button", variant: "outline", onClick: handleClick, disabled: disabled || isLoading, className: cn("cls_google_sign_in_button w-full flex items-center justify-center gap-3 h-11 border-slate-300 hover:bg-slate-50 hover:border-slate-400 transition-colors", className), "aria-label": label, children: [isLoading ? (_jsx(Loader2, { className: "h-5 w-5 animate-spin text-slate-600", "aria-hidden": "true" })) : (_jsx(GoogleIcon, { className: "h-5 w-5" })), _jsx("span", { className: "text-slate-700 font-medium", children: isLoading ? "
|
|
51
|
+
return (_jsxs(Button, { type: "button", variant: "outline", onClick: handleClick, disabled: disabled || isLoading, className: cn("cls_google_sign_in_button w-full flex items-center justify-center gap-3 h-11 border-slate-300 hover:bg-slate-50 hover:border-slate-400 transition-colors", className), "aria-label": label, children: [isLoading ? (_jsx(Loader2, { className: "h-5 w-5 animate-spin text-slate-600", "aria-hidden": "true" })) : (_jsx(GoogleIcon, { className: "h-5 w-5" })), _jsx("span", { className: "text-slate-700 font-medium", children: isLoading ? t("shared.oauth.signing_in") : label })] }));
|
|
49
52
|
}
|
|
50
53
|
export default GoogleSignInButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logout_button.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/logout_button.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logout_button.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/logout_button.tsx"],"names":[],"mappings":"AAkBA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,SAAS,GAAG,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;IACjF,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;CACzC,CAAC;AAGF,wBAAgB,YAAY,CAAC,EAC3B,SAAS,EACT,OAAmB,EACnB,IAAgB,GACjB,EAAE,iBAAiB,+BAmDnB"}
|
|
@@ -10,6 +10,9 @@ import { LogOut } from "lucide-react";
|
|
|
10
10
|
import { toast } from "sonner";
|
|
11
11
|
import { trigger_auth_status_refresh } from "../hooks/use_auth_status.js";
|
|
12
12
|
import { useHazoAuthConfig } from "../../../../contexts/hazo_auth_provider.js";
|
|
13
|
+
import en from "../../../../locales/en.json" with { type: "json" };
|
|
14
|
+
import { createPackageT } from "hazo_core/i18n";
|
|
15
|
+
const t = createPackageT("hazo_auth", en);
|
|
13
16
|
// section: component
|
|
14
17
|
export function LogoutButton({ className, variant = "outline", size = "default", }) {
|
|
15
18
|
const { apiBasePath } = useHazoAuthConfig();
|
|
@@ -26,21 +29,21 @@ export function LogoutButton({ className, variant = "outline", size = "default",
|
|
|
26
29
|
});
|
|
27
30
|
const data = await response.json();
|
|
28
31
|
if (!response.ok || !data.success) {
|
|
29
|
-
throw new Error(data.error || "
|
|
32
|
+
throw new Error(data.error || t("shared.logout.error_default"));
|
|
30
33
|
}
|
|
31
|
-
toast.success("
|
|
34
|
+
toast.success(t("shared.logout.success_toast"));
|
|
32
35
|
// Trigger auth status refresh in all components (navbar, sidebar, etc.)
|
|
33
36
|
trigger_auth_status_refresh();
|
|
34
37
|
// Refresh the page to update authentication state (cookies are cleared server-side)
|
|
35
38
|
router.refresh();
|
|
36
39
|
}
|
|
37
40
|
catch (error) {
|
|
38
|
-
const errorMessage = error instanceof Error ? error.message : "
|
|
41
|
+
const errorMessage = error instanceof Error ? error.message : t("shared.logout.error_retry");
|
|
39
42
|
toast.error(errorMessage);
|
|
40
43
|
}
|
|
41
44
|
finally {
|
|
42
45
|
setIsLoggingOut(false);
|
|
43
46
|
}
|
|
44
47
|
};
|
|
45
|
-
return (_jsxs(Button, { onClick: handleLogout, disabled: isLoggingOut, variant: variant, size: size, className: className, "aria-label": "
|
|
48
|
+
return (_jsxs(Button, { onClick: handleLogout, disabled: isLoggingOut, variant: variant, size: size, className: className, "aria-label": t("shared.logout.label"), children: [_jsx(LogOut, { className: "h-4 w-4 mr-2", "aria-hidden": "true" }), isLoggingOut ? t("shared.logout.logging_out") : t("shared.logout.label")] }));
|
|
46
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth_divider.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/oauth_divider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oauth_divider.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/oauth_divider.tsx"],"names":[],"mappings":"AASA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAGF;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAC3B,IAAwC,EACxC,SAAS,GACV,EAAE,iBAAiB,+BAoBnB;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -2,12 +2,15 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
// file_description: Visual divider between OAuth buttons and email/password form
|
|
3
3
|
// section: imports
|
|
4
4
|
import { cn } from "../../../../lib/utils.js";
|
|
5
|
+
import en from "../../../../locales/en.json" with { type: "json" };
|
|
6
|
+
import { createPackageT } from "hazo_core/i18n";
|
|
7
|
+
const t = createPackageT("hazo_auth", en);
|
|
5
8
|
// section: component
|
|
6
9
|
/**
|
|
7
10
|
* Visual divider component to separate OAuth buttons from email/password form
|
|
8
11
|
* Displays a horizontal line with text in the center
|
|
9
12
|
*/
|
|
10
|
-
export function OAuthDivider({ text = "
|
|
13
|
+
export function OAuthDivider({ text = t("shared.oauth_divider_default"), className, }) {
|
|
11
14
|
return (_jsxs("div", { className: cn("cls_oauth_divider relative my-6", className), role: "separator", "aria-orientation": "horizontal", children: [_jsx("div", { className: "absolute inset-0 flex items-center", "aria-hidden": "true", children: _jsx("span", { className: "w-full border-t border-slate-200" }) }), _jsx("div", { className: "relative flex justify-center text-sm", children: _jsx("span", { className: "bg-white px-3 text-slate-500", children: text }) })] }));
|
|
12
15
|
}
|
|
13
16
|
export default OAuthDivider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"password_field.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/password_field.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"password_field.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/password_field.tsx"],"names":[],"mappings":"AAeA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAClC,CAAC;AAGF,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,SAAS,EACT,KAAK,EACL,WAAW,EACX,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,kBAAkB,EAClB,YAAY,GACb,EAAE,kBAAkB,+BA6CpB"}
|
|
@@ -7,9 +7,12 @@ import { Eye, EyeOff } from "lucide-react";
|
|
|
7
7
|
import { Button } from "../../../ui/button.js";
|
|
8
8
|
import { Input } from "../../../ui/input.js";
|
|
9
9
|
import { FieldErrorMessage } from "./field_error_message.js";
|
|
10
|
+
import en from "../../../../locales/en.json" with { type: "json" };
|
|
11
|
+
import { createPackageT } from "hazo_core/i18n";
|
|
12
|
+
const t = createPackageT("hazo_auth", en);
|
|
10
13
|
// section: component
|
|
11
14
|
export function PasswordField({ inputId, ariaLabel, value, placeholder, autoComplete, isVisible, onChange, onToggleVisibility, errorMessage, }) {
|
|
12
|
-
return (_jsxs("div", { className: "cls_password_field_wrapper", children: [_jsxs("div", { className: "cls_password_field_container relative", style: { position: "relative" }, children: [_jsx(Input, { id: inputId, type: isVisible ? "text" : "password", value: value, onChange: (event) => onChange(event.target.value), autoComplete: autoComplete, placeholder: placeholder, "aria-label": ariaLabel, className: "cls_password_field_input pr-11", style: { paddingRight: "2.75rem" } }), _jsx(Button, { type: "button", variant: "ghost", size: "icon", "aria-label": `${isVisible ? "
|
|
15
|
+
return (_jsxs("div", { className: "cls_password_field_wrapper", children: [_jsxs("div", { className: "cls_password_field_container relative", style: { position: "relative" }, children: [_jsx(Input, { id: inputId, type: isVisible ? "text" : "password", value: value, onChange: (event) => onChange(event.target.value), autoComplete: autoComplete, placeholder: placeholder, "aria-label": ariaLabel, className: "cls_password_field_input pr-11", style: { paddingRight: "2.75rem" } }), _jsx(Button, { type: "button", variant: "ghost", size: "icon", "aria-label": `${isVisible ? t("shared.password_field.hide") : t("shared.password_field.show")} ${ariaLabel.toLowerCase()}`, onClick: onToggleVisibility, className: "cls_password_field_toggle absolute inset-y-0 right-1 my-auto h-8 w-8 text-muted-foreground hover:bg-transparent hover:text-foreground", style: {
|
|
13
16
|
position: "absolute",
|
|
14
17
|
top: "50%",
|
|
15
18
|
right: "0.25rem",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unauthorized_guard.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/unauthorized_guard.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"unauthorized_guard.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/components/unauthorized_guard.tsx"],"names":[],"mappings":"AAeA,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAGF;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,OAAwD,EACxD,gBAAyD,EACzD,SAA8B,EAC9B,QAAQ,GACT,EAAE,sBAAsB,+BA8CxB"}
|
|
@@ -7,6 +7,9 @@ import { use_auth_status } from "../hooks/use_auth_status.js";
|
|
|
7
7
|
import { Button } from "../../../ui/button.js";
|
|
8
8
|
import { useRouter } from "next/navigation";
|
|
9
9
|
import { LogIn } from "lucide-react";
|
|
10
|
+
import en from "../../../../locales/en.json" with { type: "json" };
|
|
11
|
+
import { createPackageT } from "hazo_core/i18n";
|
|
12
|
+
const t = createPackageT("hazo_auth", en);
|
|
10
13
|
// section: component
|
|
11
14
|
/**
|
|
12
15
|
* Guard component that shows unauthorized message if user is not authenticated
|
|
@@ -14,17 +17,17 @@ import { LogIn } from "lucide-react";
|
|
|
14
17
|
* @param props - Component props including message and login button customization
|
|
15
18
|
* @returns Either the unauthorized UI or the children
|
|
16
19
|
*/
|
|
17
|
-
export function UnauthorizedGuard({ message = "
|
|
20
|
+
export function UnauthorizedGuard({ message = t("shared.guard.unauthorized_message_default"), loginButtonLabel = t("shared.guard.login_button_default"), loginPath = "/hazo_auth/login", children, }) {
|
|
18
21
|
const router = useRouter();
|
|
19
22
|
const authStatus = use_auth_status();
|
|
20
23
|
// Check if user should see unauthorized message
|
|
21
24
|
const shouldShowUnauthorized = !authStatus.authenticated && !authStatus.loading;
|
|
22
25
|
if (shouldShowUnauthorized) {
|
|
23
|
-
return (_jsx("div", { className: "cls_unauthorized_guard flex flex-col items-center justify-center min-h-screen p-8", children: _jsxs("div", { className: "cls_unauthorized_guard_content flex flex-col items-center gap-4 text-center max-w-md", children: [_jsx("div", { className: "cls_unauthorized_guard_icon flex items-center justify-center w-16 h-16 rounded-full bg-red-100", children: _jsx(LogIn, { className: "h-8 w-8 text-red-600", "aria-hidden": "true" }) }), _jsxs("div", { className: "cls_unauthorized_guard_text", children: [_jsx("h1", { className: "cls_unauthorized_guard_heading text-2xl font-semibold text-slate-900 mb-2", children: "
|
|
26
|
+
return (_jsx("div", { className: "cls_unauthorized_guard flex flex-col items-center justify-center min-h-screen p-8", children: _jsxs("div", { className: "cls_unauthorized_guard_content flex flex-col items-center gap-4 text-center max-w-md", children: [_jsx("div", { className: "cls_unauthorized_guard_icon flex items-center justify-center w-16 h-16 rounded-full bg-red-100", children: _jsx(LogIn, { className: "h-8 w-8 text-red-600", "aria-hidden": "true" }) }), _jsxs("div", { className: "cls_unauthorized_guard_text", children: [_jsx("h1", { className: "cls_unauthorized_guard_heading text-2xl font-semibold text-slate-900 mb-2", children: t("shared.guard.access_denied_heading") }), _jsx("p", { className: "cls_unauthorized_guard_message text-slate-600", children: message })] }), _jsxs(Button, { onClick: () => router.push(loginPath), variant: "default", className: "cls_unauthorized_guard_login_button mt-4", "aria-label": loginButtonLabel, children: [_jsx(LogIn, { className: "h-4 w-4 mr-2", "aria-hidden": "true" }), loginButtonLabel] })] }) }));
|
|
24
27
|
}
|
|
25
28
|
// Show loading state while checking authentication
|
|
26
29
|
if (authStatus.loading) {
|
|
27
|
-
return (_jsx("div", { className: "cls_unauthorized_guard_loading flex items-center justify-center min-h-screen", children: _jsx("div", { className: "cls_unauthorized_guard_loading_text text-slate-600", children: "
|
|
30
|
+
return (_jsx("div", { className: "cls_unauthorized_guard_loading flex items-center justify-center min-h-screen", children: _jsx("div", { className: "cls_unauthorized_guard_loading_text text-slate-600", children: t("shared.guard.loading") }) }));
|
|
28
31
|
}
|
|
29
32
|
return _jsx(_Fragment, { children: children });
|
|
30
33
|
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { PasswordRequirementOptions } from "../../../../lib/utils/password_validator";
|
|
2
2
|
export type { PasswordRequirementOptions };
|
|
3
|
+
export declare const SHARED_EMAIL_FIELD_COPY: {
|
|
4
|
+
readonly label: string;
|
|
5
|
+
readonly placeholder: string;
|
|
6
|
+
readonly ariaLabel: string;
|
|
7
|
+
};
|
|
3
8
|
export type LayoutFieldId = string;
|
|
4
9
|
export type LayoutFieldDefinition = {
|
|
5
10
|
id: LayoutFieldId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout_customization.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/config/layout_customization.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"layout_customization.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/config/layout_customization.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAG3F,YAAY,EAAE,0BAA0B,EAAE,CAAC;AAU3C,eAAO,MAAM,uBAAuB;;;;CAI1B,CAAC;AAGX,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AAEnC,MAAM,MAAM,qBAAqB,GAAG;IAClC,EAAE,EAAE,aAAa,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,aAAa,EAAE,qBAAqB,CAAC,CAAC;AAC1E,MAAM,MAAM,uBAAuB,GAAG,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;AAErG,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAEhE,MAAM,MAAM,qBAAqB,GAAG;IAClC,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAEpE,MAAM,MAAM,4BAA4B,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;AAG/E,eAAO,MAAM,uBAAuB,GAClC,iBAAiB,cAAc,EAC/B,YAAY,uBAAuB,KAClC,cAqBF,CAAC;AAEF,eAAO,MAAM,aAAa,GACxB,UAAU,mBAAmB,EAC7B,YAAY,oBAAoB,KAC/B,mBAGD,CAAC;AAEH,eAAO,MAAM,oBAAoB,GAC/B,UAAU,qBAAqB,EAC/B,YAAY,sBAAsB,KACjC,qBAGD,CAAC;AAEH,eAAO,MAAM,2BAA2B,GACtC,UAAU,0BAA0B,EACpC,YAAY,4BAA4B,KACvC,0BAGD,CAAC"}
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
import en from "../../../../locales/en.json" with { type: "json" };
|
|
2
|
+
import { createPackageT } from "hazo_core/i18n";
|
|
3
|
+
// section: i18n
|
|
4
|
+
const t = createPackageT("hazo_auth", en);
|
|
5
|
+
// section: shared_field_copy
|
|
6
|
+
// The "email address" field (label / placeholder / aria-label) is repeated
|
|
7
|
+
// identically across login, register, forgot_password, and
|
|
8
|
+
// email_verification field configs — this is the single source of truth so
|
|
9
|
+
// all four end up with the same three strings (dedup: PRD §16.8 Step 0).
|
|
10
|
+
export const SHARED_EMAIL_FIELD_COPY = {
|
|
11
|
+
label: t("shared.field.email.label"),
|
|
12
|
+
placeholder: t("shared.field.email.placeholder"),
|
|
13
|
+
ariaLabel: t("shared.field.email.aria_label"),
|
|
14
|
+
};
|
|
1
15
|
// section: helpers
|
|
2
16
|
export const resolveFieldDefinitions = (baseDefinitions, overrides) => {
|
|
3
17
|
if (!overrides) {
|
|
@@ -7,6 +7,10 @@ import type { PasswordRequirementOptions } from "../config/layout_customization"
|
|
|
7
7
|
export declare function validateEmail(email: string): string | undefined;
|
|
8
8
|
/**
|
|
9
9
|
* Validates a password against specified requirements
|
|
10
|
+
*
|
|
11
|
+
* Message wording here is the canonical source shared with the server-side
|
|
12
|
+
* `validate_password()` in `lib/utils/password_validator.ts` — both produce
|
|
13
|
+
* the identical text per validation rule (dedup: PRD §16.8 Step 0).
|
|
10
14
|
* @param password - The password to validate
|
|
11
15
|
* @param requirements - Password requirement options
|
|
12
16
|
* @returns Array of error message strings if invalid, undefined if valid
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/utils/validation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/shared/utils/validation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAajF;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAM/D;AAGD;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,0BAA0B,GACvC,MAAM,EAAE,GAAG,SAAS,CAmCtB"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import en from "../../../../locales/en.json" with { type: "json" };
|
|
2
|
+
import { createPackageT } from "hazo_core/i18n";
|
|
3
|
+
// section: i18n
|
|
4
|
+
// Base-layer translator for validation messages. Falls back to the bundled
|
|
5
|
+
// English catalog whenever `hazo_i18n` is absent — see `hazo_core/src/i18n/index.ts`.
|
|
6
|
+
const t = createPackageT("hazo_auth", en);
|
|
1
7
|
// section: constants
|
|
2
8
|
const EMAIL_PATTERN = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
3
9
|
// section: email_validation
|
|
@@ -9,13 +15,17 @@ const EMAIL_PATTERN = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
|
9
15
|
export function validateEmail(email) {
|
|
10
16
|
const trimmedEmail = email.trim();
|
|
11
17
|
if (trimmedEmail.length > 0 && !EMAIL_PATTERN.test(trimmedEmail)) {
|
|
12
|
-
return "
|
|
18
|
+
return t("validation.email_invalid");
|
|
13
19
|
}
|
|
14
20
|
return undefined;
|
|
15
21
|
}
|
|
16
22
|
// section: password_validation
|
|
17
23
|
/**
|
|
18
24
|
* Validates a password against specified requirements
|
|
25
|
+
*
|
|
26
|
+
* Message wording here is the canonical source shared with the server-side
|
|
27
|
+
* `validate_password()` in `lib/utils/password_validator.ts` — both produce
|
|
28
|
+
* the identical text per validation rule (dedup: PRD §16.8 Step 0).
|
|
19
29
|
* @param password - The password to validate
|
|
20
30
|
* @param requirements - Password requirement options
|
|
21
31
|
* @returns Array of error message strings if invalid, undefined if valid
|
|
@@ -26,20 +36,22 @@ export function validatePassword(password, requirements) {
|
|
|
26
36
|
}
|
|
27
37
|
const messages = [];
|
|
28
38
|
if (password.length < requirements.minimum_length) {
|
|
29
|
-
messages.push(
|
|
39
|
+
messages.push(t("validation.password_too_short", {
|
|
40
|
+
count: String(requirements.minimum_length),
|
|
41
|
+
}));
|
|
30
42
|
}
|
|
31
43
|
if (requirements.require_uppercase && !/[A-Z]/.test(password)) {
|
|
32
|
-
messages.push("
|
|
44
|
+
messages.push(t("validation.password_missing_uppercase"));
|
|
33
45
|
}
|
|
34
46
|
if (requirements.require_lowercase && !/[a-z]/.test(password)) {
|
|
35
|
-
messages.push("
|
|
47
|
+
messages.push(t("validation.password_missing_lowercase"));
|
|
36
48
|
}
|
|
37
49
|
if (requirements.require_number && !/\d/.test(password)) {
|
|
38
|
-
messages.push("
|
|
50
|
+
messages.push(t("validation.password_missing_number"));
|
|
39
51
|
}
|
|
40
52
|
if (requirements.require_special &&
|
|
41
53
|
!/[!@#$%^&*(),.?":{}|<>\-_+=\[\];'/\\]/.test(password)) {
|
|
42
|
-
messages.push("
|
|
54
|
+
messages.push(t("validation.password_missing_special"));
|
|
43
55
|
}
|
|
44
56
|
return messages.length > 0 ? messages : undefined;
|
|
45
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"roles_matrix.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/user_management/components/roles_matrix.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"roles_matrix.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/user_management/components/roles_matrix.tsx"],"names":[],"mappings":"AAoCA,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,KAAK,CAAC;QACX,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,OAAO,CAAC;QAClB,WAAW,EAAE,MAAM,EAAE,CAAC;KACvB,CAAC,CAAC;CACJ,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAQF;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,EAC1B,kBAAyB,EACzB,2BAAkC,EAClC,qBAA6B,EAC7B,gBAAuB,EACvB,OAAO,EACP,MAAM,EACN,QAAQ,EACR,eAAe,EACf,SAAS,GACV,EAAE,gBAAgB,+BA8xBlB"}
|