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
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
// file_description: server-side password validation utility
|
|
2
|
+
//
|
|
3
|
+
// Message wording is kept identical (character-for-character) to the
|
|
4
|
+
// client-side `validatePassword()` in
|
|
5
|
+
// `components/layouts/shared/utils/validation.ts` — that file is the
|
|
6
|
+
// i18n-wired canonical source (PRD §16.8 Step 0 dedup); this server-only
|
|
7
|
+
// utility mirrors its literal English text so both call sites produce the
|
|
8
|
+
// same string, without pulling the `t()` catalog into API route code.
|
|
2
9
|
// section: types
|
|
3
10
|
export type PasswordRequirementOptions = {
|
|
4
11
|
minimum_length: number;
|
|
@@ -35,27 +42,27 @@ export function validate_password(
|
|
|
35
42
|
|
|
36
43
|
if (password.length < requirements.minimum_length) {
|
|
37
44
|
errors.push(
|
|
38
|
-
`Password must be at least ${requirements.minimum_length} characters
|
|
45
|
+
`Password must be at least ${requirements.minimum_length} characters.`
|
|
39
46
|
);
|
|
40
47
|
}
|
|
41
48
|
|
|
42
49
|
if (requirements.require_uppercase && !/[A-Z]/.test(password)) {
|
|
43
|
-
errors.push("Password must include at least one uppercase letter");
|
|
50
|
+
errors.push("Password must include at least one uppercase letter.");
|
|
44
51
|
}
|
|
45
52
|
|
|
46
53
|
if (requirements.require_lowercase && !/[a-z]/.test(password)) {
|
|
47
|
-
errors.push("Password must include at least one lowercase letter");
|
|
54
|
+
errors.push("Password must include at least one lowercase letter.");
|
|
48
55
|
}
|
|
49
56
|
|
|
50
57
|
if (requirements.require_number && !/\d/.test(password)) {
|
|
51
|
-
errors.push("Password must include at least one number");
|
|
58
|
+
errors.push("Password must include at least one number.");
|
|
52
59
|
}
|
|
53
60
|
|
|
54
61
|
if (
|
|
55
62
|
requirements.require_special &&
|
|
56
63
|
!/[!@#$%^&*(),.?":{}|<>\-_+=\[\];'/\\]/.test(password)
|
|
57
64
|
) {
|
|
58
|
-
errors.push("Password must include at least one special character");
|
|
65
|
+
errors.push("Password must include at least one special character.");
|
|
59
66
|
}
|
|
60
67
|
|
|
61
68
|
return {
|
package/dist/components/layouts/email_verification/config/email_verification_field_config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email_verification_field_config.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/email_verification/config/email_verification_field_config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACxG,OAAO,
|
|
1
|
+
{"version":3,"file":"email_verification_field_config.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/email_verification/config/email_verification_field_config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACxG,OAAO,EAKL,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EAC1B,MAAM,0CAA0C,CAAC;AAOlD,eAAO,MAAM,4BAA4B;;CAE/B,CAAC;AAEX,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,4BAA4B,CAAC,CAAC,MAAM,OAAO,4BAA4B,CAAC,CAAC;AAcxH,eAAO,MAAM,uCAAuC,GAClD,YAAY,uBAAuB,mBACwC,CAAC;AAU9E,eAAO,MAAM,8BAA8B,GAAI,YAAY,oBAAoB,wBAClB,CAAC;AAU9D,eAAO,MAAM,qCAAqC,GAAI,YAAY,sBAAsB,0BACX,CAAC;AAG9E,MAAM,MAAM,8BAA8B,GAAG;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,yCAAyC,EAAE,8BAKvD,CAAC;AAGF,MAAM,MAAM,4BAA4B,GAAG;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,uCAAuC,EAAE,4BAIrD,CAAC"}
|
package/dist/components/layouts/email_verification/config/email_verification_field_config.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { resolveButtonPalette, resolveFieldDefinitions, resolveLabels, } from "../../shared/config/layout_customization.js";
|
|
1
|
+
import { resolveButtonPalette, resolveFieldDefinitions, resolveLabels, SHARED_EMAIL_FIELD_COPY, } from "../../shared/config/layout_customization.js";
|
|
2
|
+
import en from "../../../../locales/en.json" with { type: "json" };
|
|
3
|
+
import { createPackageT } from "hazo_core/i18n";
|
|
4
|
+
const t = createPackageT("hazo_auth", en);
|
|
2
5
|
// section: field_identifiers
|
|
3
6
|
export const EMAIL_VERIFICATION_FIELD_IDS = {
|
|
4
7
|
EMAIL: "email_address",
|
|
@@ -7,20 +10,20 @@ export const EMAIL_VERIFICATION_FIELD_IDS = {
|
|
|
7
10
|
const EMAIL_VERIFICATION_FIELD_DEFINITIONS = {
|
|
8
11
|
[EMAIL_VERIFICATION_FIELD_IDS.EMAIL]: {
|
|
9
12
|
id: EMAIL_VERIFICATION_FIELD_IDS.EMAIL,
|
|
10
|
-
label:
|
|
13
|
+
label: SHARED_EMAIL_FIELD_COPY.label,
|
|
11
14
|
type: "email",
|
|
12
15
|
autoComplete: "email",
|
|
13
|
-
placeholder:
|
|
14
|
-
ariaLabel:
|
|
16
|
+
placeholder: SHARED_EMAIL_FIELD_COPY.placeholder,
|
|
17
|
+
ariaLabel: SHARED_EMAIL_FIELD_COPY.ariaLabel,
|
|
15
18
|
},
|
|
16
19
|
};
|
|
17
20
|
export const createEmailVerificationFieldDefinitions = (overrides) => resolveFieldDefinitions(EMAIL_VERIFICATION_FIELD_DEFINITIONS, overrides);
|
|
18
21
|
// section: label_defaults
|
|
19
22
|
const EMAIL_VERIFICATION_LABEL_DEFAULTS = {
|
|
20
|
-
heading: "
|
|
21
|
-
subHeading: "
|
|
22
|
-
submitButton: "
|
|
23
|
-
cancelButton: "
|
|
23
|
+
heading: t("email_verification.heading"),
|
|
24
|
+
subHeading: t("email_verification.sub_heading"),
|
|
25
|
+
submitButton: t("email_verification.submit_button"),
|
|
26
|
+
cancelButton: t("shared.cancel_button"),
|
|
24
27
|
};
|
|
25
28
|
export const resolveEmailVerificationLabels = (overrides) => resolveLabels(EMAIL_VERIFICATION_LABEL_DEFAULTS, overrides);
|
|
26
29
|
// section: button_palette_defaults
|
|
@@ -32,13 +35,13 @@ const EMAIL_VERIFICATION_BUTTON_PALETTE_DEFAULTS = {
|
|
|
32
35
|
};
|
|
33
36
|
export const resolveEmailVerificationButtonPalette = (overrides) => resolveButtonPalette(EMAIL_VERIFICATION_BUTTON_PALETTE_DEFAULTS, overrides);
|
|
34
37
|
export const EMAIL_VERIFICATION_SUCCESS_LABEL_DEFAULTS = {
|
|
35
|
-
heading: "
|
|
36
|
-
message: "
|
|
37
|
-
redirectMessage: "
|
|
38
|
-
goToLoginButton: "
|
|
38
|
+
heading: t("email_verification.success.heading"),
|
|
39
|
+
message: t("email_verification.success.message"),
|
|
40
|
+
redirectMessage: t("email_verification.success.redirect_message"),
|
|
41
|
+
goToLoginButton: t("email_verification.success.go_to_login_button"),
|
|
39
42
|
};
|
|
40
43
|
export const EMAIL_VERIFICATION_ERROR_LABEL_DEFAULTS = {
|
|
41
|
-
heading: "
|
|
42
|
-
message: "
|
|
43
|
-
resendFormHeading: "
|
|
44
|
+
heading: t("email_verification.error.heading"),
|
|
45
|
+
message: t("email_verification.error.message"),
|
|
46
|
+
resendFormHeading: t("email_verification.error.resend_form_heading"),
|
|
44
47
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_email_verification.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/email_verification/hooks/use_email_verification.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAgC,KAAK,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"use_email_verification.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/email_verification/hooks/use_email_verification.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAgC,KAAK,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AASxH,MAAM,MAAM,2BAA2B,GAAG,MAAM,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAAC;AACnF,MAAM,MAAM,2BAA2B,GAAG,OAAO,CAAC,MAAM,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAAC,GAAG;IAC5F,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,0BAA0B,CAAC,OAAO,GAAG,OAAO,IAAI;IAC1D,UAAU,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACtC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,2BAA2B,CAAC;IACpC,MAAM,EAAE,2BAA2B,CAAC;IACpC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,CAAC,OAAO,EAAE,wBAAwB,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9E,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,kBAAkB,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;IACtE,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,eAAe,EAAE,MAAM,IAAI,CAAC;CAC7B,CAAC;AAQF,eAAO,MAAM,sBAAsB,GAAI,OAAO,EAAG,2CAI9C,0BAA0B,CAAC,OAAO,CAAC,KAAG,0BAsPxC,CAAC"}
|
|
@@ -6,6 +6,9 @@ import { toast } from "sonner";
|
|
|
6
6
|
import { EMAIL_VERIFICATION_FIELD_IDS } from "../config/email_verification_field_config.js";
|
|
7
7
|
import { validateEmail } 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: helpers
|
|
10
13
|
const buildInitialValues = (initialEmail) => ({
|
|
11
14
|
[EMAIL_VERIFICATION_FIELD_IDS.EMAIL]: initialEmail || "",
|
|
@@ -42,7 +45,7 @@ export const use_email_verification = ({ dataClient, redirectDelay = 5, loginPat
|
|
|
42
45
|
}
|
|
43
46
|
if (!token) {
|
|
44
47
|
setIsError(true);
|
|
45
|
-
setErrorMessage("
|
|
48
|
+
setErrorMessage(t("email_verification.no_token_message"));
|
|
46
49
|
return;
|
|
47
50
|
}
|
|
48
51
|
const verifyToken = async () => {
|
|
@@ -55,7 +58,7 @@ export const use_email_verification = ({ dataClient, redirectDelay = 5, loginPat
|
|
|
55
58
|
});
|
|
56
59
|
const data = await response.json();
|
|
57
60
|
if (!response.ok) {
|
|
58
|
-
throw new Error(data.error || "
|
|
61
|
+
throw new Error(data.error || t("email_verification.failed_message"));
|
|
59
62
|
}
|
|
60
63
|
// Success
|
|
61
64
|
setIsVerified(true);
|
|
@@ -76,7 +79,7 @@ export const use_email_verification = ({ dataClient, redirectDelay = 5, loginPat
|
|
|
76
79
|
return () => clearInterval(countdownInterval);
|
|
77
80
|
}
|
|
78
81
|
catch (error) {
|
|
79
|
-
const errorMessage = error instanceof Error ? error.message : "
|
|
82
|
+
const errorMessage = error instanceof Error ? error.message : t("email_verification.failed_retry_message");
|
|
80
83
|
setIsError(true);
|
|
81
84
|
setErrorMessage(errorMessage);
|
|
82
85
|
// Try to extract email from error response if available
|
|
@@ -172,20 +175,20 @@ export const use_email_verification = ({ dataClient, redirectDelay = 5, loginPat
|
|
|
172
175
|
}
|
|
173
176
|
catch (jsonError) {
|
|
174
177
|
// If JSON parsing fails, the response is likely HTML (e.g., error page)
|
|
175
|
-
throw new Error("
|
|
178
|
+
throw new Error(t("shared.invalid_server_response"));
|
|
176
179
|
}
|
|
177
180
|
if (!response.ok) {
|
|
178
|
-
throw new Error(data.error || "
|
|
181
|
+
throw new Error(data.error || t("email_verification.resend_failed_title"));
|
|
179
182
|
}
|
|
180
183
|
// Show success notification
|
|
181
|
-
toast.success("
|
|
182
|
-
description: data.message || "
|
|
184
|
+
toast.success(t("email_verification.resend_success_title"), {
|
|
185
|
+
description: data.message || t("email_verification.resend_success_description"),
|
|
183
186
|
});
|
|
184
187
|
}
|
|
185
188
|
catch (error) {
|
|
186
|
-
const errorMessage = error instanceof Error ? error.message : "
|
|
189
|
+
const errorMessage = error instanceof Error ? error.message : t("email_verification.resend_failed_retry_message");
|
|
187
190
|
// Show error notification
|
|
188
|
-
toast.error("
|
|
191
|
+
toast.error(t("email_verification.resend_failed_title"), {
|
|
189
192
|
description: errorMessage,
|
|
190
193
|
});
|
|
191
194
|
// Set error state
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/email_verification/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAKlD,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EAC1B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAOL,KAAK,8BAA8B,EACnC,KAAK,4BAA4B,EAClC,MAAM,0CAA0C,CAAC;AAKlD,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/email_verification/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAKlD,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EAC1B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAOL,KAAK,8BAA8B,EACnC,KAAK,4BAA4B,EAClC,MAAM,0CAA0C,CAAC;AAKlD,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAU1E,MAAM,MAAM,4BAA4B,CAAC,OAAO,GAAG,OAAO,IAAI;IAC5D,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,cAAc,CAAC,EAAE,OAAO,CAAC,8BAA8B,CAAC,CAAC;IACzD,YAAY,CAAC,EAAE,OAAO,CAAC,4BAA4B,CAAC,CAAC;IACrD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,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,WAAW,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;CACxC,CAAC;AASF,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAAC,OAAO,EAAE,EACzD,SAAS,EACT,SAAS,EACT,sBAAkC,EAClC,eAAe,EACf,MAAM,EACN,aAAa,EACb,cAAc,EACd,YAAY,EACZ,cAAkB,EAClB,UAA+B,EAC/B,aAA2C,EAC3C,WAAW,EACX,yBAAyB,EACzB,gBAAuB,EACvB,oBAA4B,EAC5B,qBAA6D,EAC7D,cAAoB,GACrB,EAAE,4BAA4B,CAAC,OAAO,CAAC,+BAkOvC"}
|
|
@@ -14,11 +14,14 @@ import { use_email_verification, } from "./hooks/use_email_verification.js";
|
|
|
14
14
|
import { CheckCircle, XCircle, Loader2 } from "lucide-react";
|
|
15
15
|
import { AlreadyLoggedInGuard } from "../shared/components/already_logged_in_guard.js";
|
|
16
16
|
import Link from "next/link";
|
|
17
|
+
import en from "../../../locales/en.json" with { type: "json" };
|
|
18
|
+
import { createPackageT } from "hazo_core/i18n";
|
|
19
|
+
const t = createPackageT("hazo_auth", en);
|
|
17
20
|
const ORDERED_FIELDS = [
|
|
18
21
|
EMAIL_VERIFICATION_FIELD_IDS.EMAIL,
|
|
19
22
|
];
|
|
20
23
|
// section: component
|
|
21
|
-
export default function email_verification_layout({ image_src, image_alt, image_background_color = "#f1f5f9", field_overrides, labels, button_colors, success_labels, error_labels, redirect_delay = 5, login_path = "/hazo_auth/login", sign_in_label = "
|
|
24
|
+
export default function email_verification_layout({ image_src, image_alt, image_background_color = "#f1f5f9", field_overrides, labels, button_colors, success_labels, error_labels, redirect_delay = 5, login_path = "/hazo_auth/login", sign_in_label = t("shared.sign_in_default"), data_client, already_logged_in_message, showLogoutButton = true, showReturnHomeButton = false, returnHomeButtonLabel = t("shared.guard.return_home_default"), returnHomePath = "/", }) {
|
|
22
25
|
const fieldDefinitions = createEmailVerificationFieldDefinitions(field_overrides);
|
|
23
26
|
const resolvedLabels = resolveEmailVerificationLabels(labels);
|
|
24
27
|
const resolvedButtonPalette = resolveEmailVerificationButtonPalette(button_colors);
|
|
@@ -52,11 +55,11 @@ export default function email_verification_layout({ image_src, image_alt, image_
|
|
|
52
55
|
}
|
|
53
56
|
// Success state
|
|
54
57
|
if (verification.isVerified) {
|
|
55
|
-
return (_jsx(AlreadyLoggedInGuard, { image_src: image_src, image_alt: image_alt, image_background_color: image_background_color, message: already_logged_in_message, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: returnHomeButtonLabel, returnHomePath: returnHomePath, requireEmailVerified: false, children: _jsx(TwoColumnAuthLayout, { imageSrc: image_src, imageAlt: image_alt, imageBackgroundColor: image_background_color, formContent: _jsxs("div", { className: "cls_email_verification_success flex flex-col gap-6", children: [_jsxs("div", { className: "cls_email_verification_success_content flex flex-col items-center gap-4 text-center", children: [_jsx(CheckCircle, { className: "h-16 w-16 text-green-600", "aria-hidden": "true" }), _jsxs("div", { className: "cls_email_verification_success_text", children: [_jsx("h1", { className: "cls_email_verification_success_heading text-2xl font-semibold text-slate-900", children: resolvedSuccessLabels.heading }), _jsx("p", { className: "cls_email_verification_success_message mt-2 text-sm text-slate-600", children: resolvedSuccessLabels.message })] }), _jsxs("div", { className: "cls_email_verification_redirect_info mt-2 text-sm text-slate-500", children: [resolvedSuccessLabels.redirectMessage, " ", verification.redirectCountdown, "
|
|
58
|
+
return (_jsx(AlreadyLoggedInGuard, { image_src: image_src, image_alt: image_alt, image_background_color: image_background_color, message: already_logged_in_message, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: returnHomeButtonLabel, returnHomePath: returnHomePath, requireEmailVerified: false, children: _jsx(TwoColumnAuthLayout, { imageSrc: image_src, imageAlt: image_alt, imageBackgroundColor: image_background_color, formContent: _jsxs("div", { className: "cls_email_verification_success flex flex-col gap-6", children: [_jsxs("div", { className: "cls_email_verification_success_content flex flex-col items-center gap-4 text-center", children: [_jsx(CheckCircle, { className: "h-16 w-16 text-green-600", "aria-hidden": "true" }), _jsxs("div", { className: "cls_email_verification_success_text", children: [_jsx("h1", { className: "cls_email_verification_success_heading text-2xl font-semibold text-slate-900", children: resolvedSuccessLabels.heading }), _jsx("p", { className: "cls_email_verification_success_message mt-2 text-sm text-slate-600", children: resolvedSuccessLabels.message })] }), _jsxs("div", { className: "cls_email_verification_redirect_info mt-2 text-sm text-slate-500", children: [resolvedSuccessLabels.redirectMessage, " ", verification.redirectCountdown, " ", t("email_verification.redirect_seconds_suffix")] })] }), _jsx("div", { className: "cls_email_verification_success_actions flex justify-center", children: _jsx(Button, { type: "button", onClick: verification.handleGoToLogin, className: "cls_email_verification_go_to_login_button", style: {
|
|
56
59
|
backgroundColor: resolvedButtonPalette.submitBackground,
|
|
57
60
|
color: resolvedButtonPalette.submitText,
|
|
58
61
|
}, children: resolvedSuccessLabels.goToLoginButton }) })] }) }) }));
|
|
59
62
|
}
|
|
60
63
|
// Error state with resend form
|
|
61
|
-
return (_jsx(AlreadyLoggedInGuard, { image_src: image_src, image_alt: image_alt, image_background_color: image_background_color, message: already_logged_in_message, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: returnHomeButtonLabel, returnHomePath: returnHomePath, requireEmailVerified: false, children: _jsx(TwoColumnAuthLayout, { imageSrc: image_src, imageAlt: image_alt, imageBackgroundColor: image_background_color, formContent: _jsxs(_Fragment, { children: [_jsxs("div", { className: "cls_email_verification_error_header flex flex-col items-center gap-4 text-center", children: [_jsx(XCircle, { className: "h-12 w-12 text-red-600", "aria-hidden": "true" }), _jsxs("div", { className: "cls_email_verification_error_text", children: [_jsx("h1", { className: "cls_email_verification_error_heading text-2xl font-semibold text-slate-900", children: resolvedErrorLabels.heading }), _jsx("p", { className: "cls_email_verification_error_message mt-2 text-sm text-slate-600", children: verification.errorMessage || resolvedErrorLabels.message })] })] }), _jsxs("div", { className: "cls_email_verification_resend_form", children: [_jsx(FormHeader, { heading: resolvedErrorLabels.resendFormHeading, subHeading: "
|
|
64
|
+
return (_jsx(AlreadyLoggedInGuard, { image_src: image_src, image_alt: image_alt, image_background_color: image_background_color, message: already_logged_in_message, showLogoutButton: showLogoutButton, showReturnHomeButton: showReturnHomeButton, returnHomeButtonLabel: returnHomeButtonLabel, returnHomePath: returnHomePath, requireEmailVerified: false, children: _jsx(TwoColumnAuthLayout, { imageSrc: image_src, imageAlt: image_alt, imageBackgroundColor: image_background_color, formContent: _jsxs(_Fragment, { children: [_jsxs("div", { className: "cls_email_verification_error_header flex flex-col items-center gap-4 text-center", children: [_jsx(XCircle, { className: "h-12 w-12 text-red-600", "aria-hidden": "true" }), _jsxs("div", { className: "cls_email_verification_error_text", children: [_jsx("h1", { className: "cls_email_verification_error_heading text-2xl font-semibold text-slate-900", children: resolvedErrorLabels.heading }), _jsx("p", { className: "cls_email_verification_error_message mt-2 text-sm text-slate-600", children: verification.errorMessage || resolvedErrorLabels.message })] })] }), _jsxs("div", { className: "cls_email_verification_resend_form", children: [_jsx(FormHeader, { heading: resolvedErrorLabels.resendFormHeading, subHeading: t("email_verification.resend_email_prompt") }), _jsxs("form", { className: "cls_email_verification_layout_form_fields flex flex-col gap-5", onSubmit: verification.handleResendSubmit, "aria-label": t("email_verification.aria.resend_form"), children: [renderFields(verification), _jsx(FormActionButtons, { submitLabel: resolvedLabels.submitButton, cancelLabel: resolvedLabels.cancelButton, buttonPalette: resolvedButtonPalette, isSubmitDisabled: verification.isSubmitDisabled, onCancel: verification.handleCancel, submitAriaLabel: t("email_verification.aria.resend_submit"), cancelAriaLabel: t("email_verification.aria.resend_cancel") }), verification.isSubmitting && (_jsx("div", { className: "cls_email_verification_submitting_indicator text-sm text-slate-600 text-center", children: t("email_verification.sending_indicator") }))] }), _jsxs("div", { className: "cls_email_verification_sign_in_link mt-4 text-center text-sm text-slate-600", children: [t("email_verification.already_verified_prompt"), " ", _jsx(Link, { href: login_path, className: "font-medium text-slate-900 hover:underline", children: sign_in_label })] })] })] }) }) }));
|
|
62
65
|
}
|
package/dist/components/layouts/forgot_password/config/forgot_password_field_config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forgot_password_field_config.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/forgot_password/config/forgot_password_field_config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACxG,OAAO,
|
|
1
|
+
{"version":3,"file":"forgot_password_field_config.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/forgot_password/config/forgot_password_field_config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACxG,OAAO,EAKL,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EAC1B,MAAM,0CAA0C,CAAC;AAOlD,eAAO,MAAM,yBAAyB;;CAE5B,CAAC;AAEX,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,OAAO,yBAAyB,CAAC,CAAC;AAc/G,eAAO,MAAM,oCAAoC,GAC/C,YAAY,uBAAuB,mBACqC,CAAC;AAU3E,eAAO,MAAM,2BAA2B,GAAI,YAAY,oBAAoB,wBAClB,CAAC;AAU3D,eAAO,MAAM,kCAAkC,GAAI,YAAY,sBAAsB,0BACX,CAAC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { resolveButtonPalette, resolveFieldDefinitions, resolveLabels, } from "../../shared/config/layout_customization.js";
|
|
1
|
+
import { resolveButtonPalette, resolveFieldDefinitions, resolveLabels, SHARED_EMAIL_FIELD_COPY, } from "../../shared/config/layout_customization.js";
|
|
2
|
+
import en from "../../../../locales/en.json" with { type: "json" };
|
|
3
|
+
import { createPackageT } from "hazo_core/i18n";
|
|
4
|
+
const t = createPackageT("hazo_auth", en);
|
|
2
5
|
// section: field_identifiers
|
|
3
6
|
export const FORGOT_PASSWORD_FIELD_IDS = {
|
|
4
7
|
EMAIL: "email_address",
|
|
@@ -7,20 +10,20 @@ export const FORGOT_PASSWORD_FIELD_IDS = {
|
|
|
7
10
|
const FORGOT_PASSWORD_FIELD_DEFINITIONS = {
|
|
8
11
|
[FORGOT_PASSWORD_FIELD_IDS.EMAIL]: {
|
|
9
12
|
id: FORGOT_PASSWORD_FIELD_IDS.EMAIL,
|
|
10
|
-
label:
|
|
13
|
+
label: SHARED_EMAIL_FIELD_COPY.label,
|
|
11
14
|
type: "email",
|
|
12
15
|
autoComplete: "email",
|
|
13
|
-
placeholder:
|
|
14
|
-
ariaLabel:
|
|
16
|
+
placeholder: SHARED_EMAIL_FIELD_COPY.placeholder,
|
|
17
|
+
ariaLabel: SHARED_EMAIL_FIELD_COPY.ariaLabel,
|
|
15
18
|
},
|
|
16
19
|
};
|
|
17
20
|
export const createForgotPasswordFieldDefinitions = (overrides) => resolveFieldDefinitions(FORGOT_PASSWORD_FIELD_DEFINITIONS, overrides);
|
|
18
21
|
// section: label_defaults
|
|
19
22
|
const FORGOT_PASSWORD_LABEL_DEFAULTS = {
|
|
20
|
-
heading: "
|
|
21
|
-
subHeading: "
|
|
22
|
-
submitButton: "
|
|
23
|
-
cancelButton: "
|
|
23
|
+
heading: t("forgot_password.heading"),
|
|
24
|
+
subHeading: t("forgot_password.sub_heading"),
|
|
25
|
+
submitButton: t("forgot_password.submit_button"),
|
|
26
|
+
cancelButton: t("shared.cancel_button"),
|
|
24
27
|
};
|
|
25
28
|
export const resolveForgotPasswordLabels = (overrides) => resolveLabels(FORGOT_PASSWORD_LABEL_DEFAULTS, overrides);
|
|
26
29
|
// section: button_palette_defaults
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_forgot_password_form.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/forgot_password/hooks/use_forgot_password_form.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAA6B,KAAK,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"use_forgot_password_form.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/forgot_password/hooks/use_forgot_password_form.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAA6B,KAAK,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAS/G,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AAC7E,MAAM,MAAM,wBAAwB,GAAG,OAAO,CAAC,MAAM,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC,GAAG;IACtF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,2BAA2B,CAAC,OAAO,GAAG,OAAO,IAAI;IAC3D,UAAU,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACxC,MAAM,EAAE,wBAAwB,CAAC;IACjC,MAAM,EAAE,wBAAwB,CAAC;IACjC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;IACtB,iFAAiF;IACjF,mBAAmB,EAAE,OAAO,CAAC;IAC7B,iBAAiB,EAAE,CAAC,OAAO,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3E,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,YAAY,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;IAChE,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B,CAAC;AAQF,eAAO,MAAM,wBAAwB,GAAI,OAAO,EAAG,iBAEhD,2BAA2B,CAAC,OAAO,CAAC,KAAG,2BAqJzC,CAAC"}
|
|
@@ -5,6 +5,9 @@ import { toast } from "sonner";
|
|
|
5
5
|
import { FORGOT_PASSWORD_FIELD_IDS } from "../config/forgot_password_field_config.js";
|
|
6
6
|
import { validateEmail } from "../../shared/utils/validation.js";
|
|
7
7
|
import { useHazoAuthConfig } from "../../../../contexts/hazo_auth_provider.js";
|
|
8
|
+
import en from "../../../../locales/en.json" with { type: "json" };
|
|
9
|
+
import { createPackageT } from "hazo_core/i18n";
|
|
10
|
+
const t = createPackageT("hazo_auth", en);
|
|
8
11
|
// section: helpers
|
|
9
12
|
const buildInitialValues = () => ({
|
|
10
13
|
[FORGOT_PASSWORD_FIELD_IDS.EMAIL]: "",
|
|
@@ -86,7 +89,7 @@ export const use_forgot_password_form = ({ dataClient, }) => {
|
|
|
86
89
|
});
|
|
87
90
|
const data = await response.json();
|
|
88
91
|
if (!response.ok) {
|
|
89
|
-
throw new Error(data.error || "
|
|
92
|
+
throw new Error(data.error || t("forgot_password.request_failed"));
|
|
90
93
|
}
|
|
91
94
|
// Check if user is a Google-only account (no password set)
|
|
92
95
|
if (data.no_password_set) {
|
|
@@ -94,8 +97,8 @@ export const use_forgot_password_form = ({ dataClient, }) => {
|
|
|
94
97
|
return;
|
|
95
98
|
}
|
|
96
99
|
// Show success notification
|
|
97
|
-
toast.success("
|
|
98
|
-
description: "
|
|
100
|
+
toast.success(t("forgot_password.success_toast_title"), {
|
|
101
|
+
description: t("forgot_password.success_toast_description"),
|
|
99
102
|
});
|
|
100
103
|
// Reset form on success
|
|
101
104
|
setValues(buildInitialValues());
|
|
@@ -103,9 +106,9 @@ export const use_forgot_password_form = ({ dataClient, }) => {
|
|
|
103
106
|
setEmailTouched(false);
|
|
104
107
|
}
|
|
105
108
|
catch (error) {
|
|
106
|
-
const errorMessage = error instanceof Error ? error.message : "
|
|
109
|
+
const errorMessage = error instanceof Error ? error.message : t("forgot_password.request_failed_retry");
|
|
107
110
|
// Show error notification
|
|
108
|
-
toast.error("
|
|
111
|
+
toast.error(t("forgot_password.failed_toast_title"), {
|
|
109
112
|
description: errorMessage,
|
|
110
113
|
});
|
|
111
114
|
// Set error state
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/forgot_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,EAC1B,MAAM,uCAAuC,CAAC;AAW/C,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/forgot_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,EAC1B,MAAM,uCAAuC,CAAC;AAW/C,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAQ1E,MAAM,MAAM,yBAAyB,CAAC,OAAO,GAAG,OAAO,IAAI;IACzD,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,WAAW,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,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,yEAAyE;IACzE,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AASF,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,OAAO,EAAE,EACtD,SAAS,EACT,SAAS,EACT,sBAAkC,EAClC,eAAe,EACf,MAAM,EACN,aAAa,EACb,WAAW,EACX,YAAiC,EACjC,aAA2C,EAC3C,sBAAyE,EACzE,gBAAuB,EACvB,oBAA4B,EAC5B,qBAA6D,EAC7D,cAAoB,EACpB,wBAAmE,EACnE,wBAAmE,EACnE,yBAAsE,EACtE,cAAyC,EACzC,eAAgE,GACjE,EAAE,yBAAyB,CAAC,OAAO,CAAC,+BAgJpC"}
|
|
@@ -13,11 +13,14 @@ import { GoogleSignInButton } from "../shared/components/google_sign_in_button.j
|
|
|
13
13
|
import { FORGOT_PASSWORD_FIELD_IDS, createForgotPasswordFieldDefinitions, resolveForgotPasswordButtonPalette, resolveForgotPasswordLabels, } from "./config/forgot_password_field_config.js";
|
|
14
14
|
import { use_forgot_password_form, } from "./hooks/use_forgot_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
|
FORGOT_PASSWORD_FIELD_IDS.EMAIL,
|
|
18
21
|
];
|
|
19
22
|
// section: component
|
|
20
|
-
export default function forgot_password_layout({ image_src, image_alt, image_background_color = "#f1f5f9", field_overrides, labels, button_colors, data_client, sign_in_path = "/hazo_auth/login", sign_in_label = "
|
|
23
|
+
export default function forgot_password_layout({ image_src, image_alt, image_background_color = "#f1f5f9", field_overrides, labels, button_colors, data_client, sign_in_path = "/hazo_auth/login", sign_in_label = t("shared.sign_in_default"), alreadyLoggedInMessage = t("shared.guard.already_logged_in_prop_default"), showLogoutButton = true, showReturnHomeButton = false, returnHomeButtonLabel = t("shared.guard.return_home_default"), returnHomePath = "/", googleOnlyAccountHeading = t("forgot_password.google_only.heading"), googleOnlyAccountMessage = t("forgot_password.google_only.message"), googleOnlyAccountHelpText = t("forgot_password.google_only.help_text"), mySettingsPath = "/hazo_auth/my_settings", mySettingsLabel = t("forgot_password.my_settings_label_default"), }) {
|
|
21
24
|
const fieldDefinitions = createForgotPasswordFieldDefinitions(field_overrides);
|
|
22
25
|
const resolvedLabels = resolveForgotPasswordLabels(labels);
|
|
23
26
|
const resolvedButtonPalette = resolveForgotPasswordButtonPalette(button_colors);
|
|
@@ -43,7 +46,7 @@ export default function forgot_password_layout({ image_src, image_alt, image_bac
|
|
|
43
46
|
};
|
|
44
47
|
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: _jsx(_Fragment, { children: form.isGoogleOnlyAccount ? (
|
|
45
48
|
/* Google-only account message */
|
|
46
|
-
_jsxs("div", { className: "cls_forgot_password_google_only flex flex-col gap-5", children: [_jsx(FormHeader, { heading: googleOnlyAccountHeading, subHeading: googleOnlyAccountMessage }), _jsx("p", { className: "cls_forgot_password_google_only_help text-sm text-slate-600", children: googleOnlyAccountHelpText }), _jsxs("div", { className: "cls_forgot_password_google_only_actions flex flex-col gap-3", children: [_jsx(GoogleSignInButton, { label: "
|
|
49
|
+
_jsxs("div", { className: "cls_forgot_password_google_only flex flex-col gap-5", children: [_jsx(FormHeader, { heading: googleOnlyAccountHeading, subHeading: googleOnlyAccountMessage }), _jsx("p", { className: "cls_forgot_password_google_only_help text-sm text-slate-600", children: googleOnlyAccountHelpText }), _jsxs("div", { className: "cls_forgot_password_google_only_actions flex flex-col gap-3", children: [_jsx(GoogleSignInButton, { label: t("forgot_password.google_only.sign_in_google") }), _jsx(Link, { href: mySettingsPath, className: "cls_forgot_password_settings_link text-center text-sm font-medium text-slate-700 hover:text-slate-900 hover:underline", children: mySettingsLabel })] }), _jsx("div", { className: "cls_forgot_password_sign_in_link mt-2 text-center text-sm text-slate-600", children: _jsx(Link, { href: sign_in_path, className: "font-medium text-slate-900 hover:underline", children: t("forgot_password.back_to", { sign_in_label }) }) })] })) : (
|
|
47
50
|
/* Normal forgot password form */
|
|
48
|
-
_jsxs(_Fragment, { children: [_jsx(FormHeader, { heading: resolvedLabels.heading, subHeading: resolvedLabels.subHeading }), _jsxs("form", { className: "cls_forgot_password_layout_form_fields flex flex-col gap-5", onSubmit: form.handleSubmit, "aria-label": "
|
|
51
|
+
_jsxs(_Fragment, { children: [_jsx(FormHeader, { heading: resolvedLabels.heading, subHeading: resolvedLabels.subHeading }), _jsxs("form", { className: "cls_forgot_password_layout_form_fields flex flex-col gap-5", onSubmit: form.handleSubmit, "aria-label": t("forgot_password.aria.form"), children: [renderFields(form), _jsx(FormActionButtons, { submitLabel: resolvedLabels.submitButton, cancelLabel: resolvedLabels.cancelButton, buttonPalette: resolvedButtonPalette, isSubmitDisabled: form.isSubmitDisabled, onCancel: form.handleCancel, submitAriaLabel: t("forgot_password.aria.submit"), cancelAriaLabel: t("forgot_password.aria.cancel") }), form.isSubmitting && (_jsx("div", { className: "cls_forgot_password_submitting_indicator text-sm text-slate-600 text-center", children: t("forgot_password.submitting_indicator") }))] }), _jsxs("div", { className: "cls_forgot_password_sign_in_link mt-4 text-center text-sm text-slate-600", children: [t("forgot_password.sign_in_prompt"), " ", _jsx(Link, { href: sign_in_path, className: "font-medium text-slate-900 hover:underline", children: sign_in_label })] })] })) }) }) }));
|
|
49
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login_field_config.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/login/config/login_field_config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACxG,OAAO,
|
|
1
|
+
{"version":3,"file":"login_field_config.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/login/config/login_field_config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACxG,OAAO,EAKL,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EAC1B,MAAM,0CAA0C,CAAC;AAOlD,eAAO,MAAM,eAAe;;;CAGlB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AAsBlF,eAAO,MAAM,2BAA2B,GACtC,YAAY,uBAAuB,mBAC2B,CAAC;AAUjE,eAAO,MAAM,kBAAkB,GAAI,YAAY,oBAAoB,wBACnB,CAAC;AAUjD,eAAO,MAAM,yBAAyB,GAAI,YAAY,sBAAsB,0BACZ,CAAC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { resolveButtonPalette, resolveFieldDefinitions, resolveLabels, } from "../../shared/config/layout_customization.js";
|
|
1
|
+
import { resolveButtonPalette, resolveFieldDefinitions, resolveLabels, SHARED_EMAIL_FIELD_COPY, } from "../../shared/config/layout_customization.js";
|
|
2
|
+
import en from "../../../../locales/en.json" with { type: "json" };
|
|
3
|
+
import { createPackageT } from "hazo_core/i18n";
|
|
4
|
+
const t = createPackageT("hazo_auth", en);
|
|
2
5
|
// section: field_identifiers
|
|
3
6
|
export const LOGIN_FIELD_IDS = {
|
|
4
7
|
EMAIL: "email_address",
|
|
@@ -8,28 +11,28 @@ export const LOGIN_FIELD_IDS = {
|
|
|
8
11
|
const LOGIN_FIELD_DEFINITIONS = {
|
|
9
12
|
[LOGIN_FIELD_IDS.EMAIL]: {
|
|
10
13
|
id: LOGIN_FIELD_IDS.EMAIL,
|
|
11
|
-
label:
|
|
14
|
+
label: SHARED_EMAIL_FIELD_COPY.label,
|
|
12
15
|
type: "email",
|
|
13
16
|
autoComplete: "email",
|
|
14
|
-
placeholder:
|
|
15
|
-
ariaLabel:
|
|
17
|
+
placeholder: SHARED_EMAIL_FIELD_COPY.placeholder,
|
|
18
|
+
ariaLabel: SHARED_EMAIL_FIELD_COPY.ariaLabel,
|
|
16
19
|
},
|
|
17
20
|
[LOGIN_FIELD_IDS.PASSWORD]: {
|
|
18
21
|
id: LOGIN_FIELD_IDS.PASSWORD,
|
|
19
|
-
label: "
|
|
22
|
+
label: t("login.field.password.label"),
|
|
20
23
|
type: "password",
|
|
21
24
|
autoComplete: "current-password",
|
|
22
|
-
placeholder: "
|
|
23
|
-
ariaLabel: "
|
|
25
|
+
placeholder: t("login.field.password.placeholder"),
|
|
26
|
+
ariaLabel: t("login.field.password.aria_label"),
|
|
24
27
|
},
|
|
25
28
|
};
|
|
26
29
|
export const createLoginFieldDefinitions = (overrides) => resolveFieldDefinitions(LOGIN_FIELD_DEFINITIONS, overrides);
|
|
27
30
|
// section: label_defaults
|
|
28
31
|
const LOGIN_LABEL_DEFAULTS = {
|
|
29
|
-
heading: "
|
|
30
|
-
subHeading: "
|
|
31
|
-
submitButton: "
|
|
32
|
-
cancelButton: "
|
|
32
|
+
heading: t("login.heading"),
|
|
33
|
+
subHeading: t("login.sub_heading"),
|
|
34
|
+
submitButton: t("login.submit_button"),
|
|
35
|
+
cancelButton: t("shared.cancel_button"),
|
|
33
36
|
};
|
|
34
37
|
export const resolveLoginLabels = (overrides) => resolveLabels(LOGIN_LABEL_DEFAULTS, overrides);
|
|
35
38
|
// section: button_palette_defaults
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use_login_form.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/login/hooks/use_login_form.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"use_login_form.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/login/hooks/use_login_form.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAWlF,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AAC3D,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;AACpE,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,kBAAkB,CAAC,OAAO,GAAG,OAAO,IAAI;IAClD,UAAU,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACtC,MAAM,CAAC,EAAE;QACP,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;QAChE,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;QACjE,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;QAChE,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;KAClE,CAAC;IACF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,EAAE,eAAe,CAAC;IACxB,kBAAkB,EAAE,uBAAuB,CAAC;IAC5C,gBAAgB,EAAE,OAAO,CAAC;IAC1B,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,iBAAiB,EAAE,CAAC,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClE,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,wBAAwB,EAAE,MAAM,IAAI,CAAC;IACrC,YAAY,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;IAChE,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B,CAAC;AAGF,eAAO,MAAM,kBAAkB,GAAI,WAAW,OAAO,CAAC,eAAe,CAAC,KAAG,eAGvE,CAAC;AAYH,eAAO,MAAM,cAAc,GAAI,OAAO,EAAG,mFAOtC,kBAAkB,CAAC,OAAO,CAAC,KAAG,kBA2NhC,CAAC"}
|
|
@@ -7,6 +7,9 @@ import { validateEmail } from "../../shared/utils/validation.js";
|
|
|
7
7
|
import { get_client_ip } from "../../shared/utils/ip_address.js";
|
|
8
8
|
import { trigger_auth_status_refresh } from "../../shared/hooks/use_auth_status.js";
|
|
9
9
|
import { useHazoAuthConfig } from "../../../../contexts/hazo_auth_provider.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: helpers
|
|
11
14
|
export const buildInitialValues = (defaults) => {
|
|
12
15
|
var _a, _b;
|
|
@@ -23,7 +26,7 @@ const get_line_number = () => {
|
|
|
23
26
|
return 0;
|
|
24
27
|
};
|
|
25
28
|
// section: hook
|
|
26
|
-
export const use_login_form = ({ dataClient, logger, redirectRoute, successMessage = "
|
|
29
|
+
export const use_login_form = ({ dataClient, logger, redirectRoute, successMessage = t("login.success_message_default"), urlOnLogon, defaultValues, }) => {
|
|
27
30
|
const router = useRouter();
|
|
28
31
|
const { apiBasePath } = useHazoAuthConfig();
|
|
29
32
|
const [values, setValues] = useState(() => buildInitialValues(defaultValues));
|
|
@@ -132,12 +135,12 @@ export const use_login_form = ({ dataClient, logger, redirectRoute, successMessa
|
|
|
132
135
|
if (data.email_not_verified) {
|
|
133
136
|
// Redirect to verify_email page with email and message
|
|
134
137
|
const emailParam = encodeURIComponent(email);
|
|
135
|
-
const messageParam = encodeURIComponent("
|
|
138
|
+
const messageParam = encodeURIComponent(t("login.email_not_verified_message"));
|
|
136
139
|
router.push(`/hazo_auth/verify_email?email=${emailParam}&message=${messageParam}`);
|
|
137
140
|
return;
|
|
138
141
|
}
|
|
139
142
|
// Login failed for other reasons
|
|
140
|
-
const errorMessage = data.error || "
|
|
143
|
+
const errorMessage = data.error || t("login.failed_message");
|
|
141
144
|
// Log failed login attempt
|
|
142
145
|
log_login_attempt(false, errorMessage);
|
|
143
146
|
// Set error state (remain on same page)
|
|
@@ -166,7 +169,7 @@ export const use_login_form = ({ dataClient, logger, redirectRoute, successMessa
|
|
|
166
169
|
}
|
|
167
170
|
}
|
|
168
171
|
catch (error) {
|
|
169
|
-
const errorMessage = error instanceof Error ? error.message : "
|
|
172
|
+
const errorMessage = error instanceof Error ? error.message : t("shared.unknown_error");
|
|
170
173
|
// Log failed login attempt
|
|
171
174
|
log_login_attempt(false, errorMessage);
|
|
172
175
|
// Set error state (remain on same page)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/login/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAYlD,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EAC1B,MAAM,uCAAuC,CAAC;AAW/C,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/layouts/login/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAYlD,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EAC1B,MAAM,uCAAuC,CAAC;AAW/C,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAO1E,MAAM,MAAM,iBAAiB,GAAG;IAC9B,gCAAgC;IAChC,aAAa,EAAE,OAAO,CAAC;IACvB,8CAA8C;IAC9C,qBAAqB,EAAE,OAAO,CAAC;IAC/B,kDAAkD;IAClD,kBAAkB,EAAE,MAAM,CAAC;IAC3B,0EAA0E;IAC1E,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kCAAkC;IAClC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,oDAAoD;IACpD,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAAC,OAAO,GAAG,OAAO,IAAI;IAChD,6HAA6H;IAC7H,SAAS,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC;IACrC,0GAA0G;IAC1G,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,eAAe,CAAC,EAAE,uBAAuB,CAAC;IAC1C,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,aAAa,CAAC,EAAE,sBAAsB,CAAC;IACvC,WAAW,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACvC,MAAM,CAAC,EAAE;QACP,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;QAChE,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;QACjE,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;QAChE,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;KAClE,CAAC;IACF,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,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,sDAAsD;IACtD,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0BAA0B;IAC1B,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B,+EAA+E;IAC/E,cAAc,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACvD;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,YAAY,GAAG,WAAW,CAAC;CACrC,CAAC;AAUF,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,OAAO,EAAE,EAC5C,SAAS,EACT,SAAS,EACT,sBAAkC,EAClC,eAAe,EACf,MAAM,EACN,aAAa,EACb,WAAW,EACX,MAAM,EACN,aAAa,EACb,cAAmD,EACnD,sBAAyE,EACzE,gBAAuB,EACvB,oBAA4B,EAC5B,qBAA6D,EAC7D,cAAoB,EACpB,oBAAmD,EACnD,qBAA+D,EAC/D,mBAA2C,EAC3C,oBAA6D,EAC7D,wBAA+B,EAC/B,UAAU,EACV,KAAK,EACL,MAAqB,EACrB,cAAc,GACf,EAAE,gBAAgB,CAAC,OAAO,CAAC,+BAqR3B"}
|
|
@@ -18,21 +18,24 @@ import { FacebookSignInButton } from "../shared/components/facebook_sign_in_butt
|
|
|
18
18
|
import { OAuthDivider } from "../shared/components/oauth_divider.js";
|
|
19
19
|
import { LOGIN_FIELD_IDS, createLoginFieldDefinitions, resolveLoginButtonPalette, resolveLoginLabels, } from "./config/login_field_config.js";
|
|
20
20
|
import { use_login_form, } from "./hooks/use_login_form.js";
|
|
21
|
+
import en from "../../../locales/en.json" with { type: "json" };
|
|
22
|
+
import { createPackageT } from "hazo_core/i18n";
|
|
23
|
+
const t = createPackageT("hazo_auth", en);
|
|
21
24
|
const ORDERED_FIELDS = [
|
|
22
25
|
LOGIN_FIELD_IDS.EMAIL,
|
|
23
26
|
LOGIN_FIELD_IDS.PASSWORD,
|
|
24
27
|
];
|
|
25
28
|
// section: component
|
|
26
|
-
export default function login_layout({ image_src, image_alt, image_background_color = "#f1f5f9", field_overrides, labels, button_colors, data_client, logger, redirectRoute, successMessage = "
|
|
29
|
+
export default function login_layout({ image_src, image_alt, image_background_color = "#f1f5f9", field_overrides, labels, button_colors, data_client, logger, redirectRoute, successMessage = t("login.success_message_default"), alreadyLoggedInMessage = t("shared.guard.already_logged_in_prop_default"), showLogoutButton = true, showReturnHomeButton = false, returnHomeButtonLabel = t("shared.guard.return_home_default"), returnHomePath = "/", forgot_password_path = "/hazo_auth/forgot_password", forgot_password_label = t("login.forgot_password_link_default"), create_account_path = "/hazo_auth/register", create_account_label = t("login.create_account_link_default"), show_create_account_link = true, urlOnLogon, oauth, layout = "two_column", default_values, }) {
|
|
27
30
|
var _a, _b, _c;
|
|
28
31
|
// Default OAuth config: both enabled
|
|
29
32
|
const oauthConfig = oauth || {
|
|
30
33
|
enable_google: true,
|
|
31
34
|
enable_email_password: true,
|
|
32
|
-
google_button_text: "
|
|
33
|
-
oauth_divider_text: "
|
|
35
|
+
google_button_text: t("shared.oauth.google_button_default"),
|
|
36
|
+
oauth_divider_text: t("shared.oauth_divider_default"),
|
|
34
37
|
enable_facebook_oauth: false,
|
|
35
|
-
facebook_button_text: "
|
|
38
|
+
facebook_button_text: t("shared.oauth.facebook_button_default"),
|
|
36
39
|
};
|
|
37
40
|
// Read OAuth error from URL query params (e.g., ?error=AccessDenied)
|
|
38
41
|
const searchParams = useSearchParams();
|
|
@@ -55,13 +58,13 @@ export default function login_layout({ image_src, image_alt, image_background_co
|
|
|
55
58
|
const getOAuthErrorMessage = (error) => {
|
|
56
59
|
switch (error) {
|
|
57
60
|
case "AccessDenied":
|
|
58
|
-
return "
|
|
61
|
+
return t("shared.oauth_error.access_denied");
|
|
59
62
|
case "OAuthSignin":
|
|
60
63
|
case "OAuthCallback":
|
|
61
64
|
case "OAuthCreateAccount":
|
|
62
|
-
return "
|
|
65
|
+
return t("shared.oauth_error.signin_failed");
|
|
63
66
|
default:
|
|
64
|
-
return "
|
|
67
|
+
return t("shared.oauth_error.generic");
|
|
65
68
|
}
|
|
66
69
|
};
|
|
67
70
|
const fieldDefinitions = createLoginFieldDefinitions(field_overrides);
|
|
@@ -102,7 +105,7 @@ export default function login_layout({ image_src, image_alt, image_background_co
|
|
|
102
105
|
// into TwoColumnAuthLayout's `formContent`; in "form_only" mode it's returned
|
|
103
106
|
// as the entire output for the consumer to compose into their own chrome.
|
|
104
107
|
const successContent = (_jsxs(_Fragment, { children: [_jsx(FormHeader, { heading: resolvedLabels.heading, subHeading: resolvedLabels.subHeading }), _jsxs("div", { className: "cls_login_layout_success flex flex-col items-center justify-center gap-4 p-8 text-center", children: [_jsx(CheckCircle, { className: "cls_login_layout_success_icon h-16 w-16 text-green-600", "aria-hidden": "true" }), _jsx("p", { className: "cls_login_layout_success_message text-lg font-medium text-slate-900", children: successMessage })] })] }));
|
|
105
|
-
const mainContent = (_jsxs(_Fragment, { children: [_jsx(FormHeader, { heading: resolvedLabels.heading, subHeading: resolvedLabels.subHeading }), oauthError && (_jsxs("div", { className: "cls_login_layout_oauth_error flex items-center gap-2 rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700", children: [_jsx(AlertCircle, { className: "h-4 w-4 shrink-0", "aria-hidden": "true" }), _jsx("span", { children: getOAuthErrorMessage(oauthError) })] })), oauthConfig.enable_google && (_jsx("div", { className: "cls_login_layout_oauth_section", children: _jsx(GoogleSignInButton, { label: oauthConfig.google_button_text, callbackUrl: oauthCallbackUrl }) })), oauthConfig.enable_facebook_oauth && (_jsx("div", { className: "cls_login_layout_facebook_section", children: _jsx(FacebookSignInButton, { label: oauthConfig.facebook_button_text || "
|
|
108
|
+
const mainContent = (_jsxs(_Fragment, { children: [_jsx(FormHeader, { heading: resolvedLabels.heading, subHeading: resolvedLabels.subHeading }), oauthError && (_jsxs("div", { className: "cls_login_layout_oauth_error flex items-center gap-2 rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700", children: [_jsx(AlertCircle, { className: "h-4 w-4 shrink-0", "aria-hidden": "true" }), _jsx("span", { children: getOAuthErrorMessage(oauthError) })] })), oauthConfig.enable_google && (_jsx("div", { className: "cls_login_layout_oauth_section", children: _jsx(GoogleSignInButton, { label: oauthConfig.google_button_text, callbackUrl: oauthCallbackUrl }) })), oauthConfig.enable_facebook_oauth && (_jsx("div", { className: "cls_login_layout_facebook_section", children: _jsx(FacebookSignInButton, { label: oauthConfig.facebook_button_text || t("shared.oauth.facebook_button_default"), callbackUrl: "/api/hazo_auth/oauth/facebook/callback" }) })), (oauthConfig.enable_google || oauthConfig.enable_facebook_oauth) && oauthConfig.enable_email_password && (_jsx(OAuthDivider, { text: oauthConfig.oauth_divider_text })), oauthConfig.enable_email_password && (_jsxs("form", { className: "cls_login_layout_form_fields flex flex-col gap-5", onSubmit: form.handleSubmit, "aria-label": t("login.aria.form"), children: [renderFields(form), _jsx(FormActionButtons, { submitLabel: resolvedLabels.submitButton, cancelLabel: resolvedLabels.cancelButton, buttonPalette: resolvedButtonPalette, isSubmitDisabled: form.isSubmitDisabled, onCancel: form.handleCancel, submitAriaLabel: t("login.aria.submit"), cancelAriaLabel: t("login.aria.cancel") }), ((forgot_password_path && forgot_password_label) || (show_create_account_link && create_account_path && create_account_label)) && (_jsxs("div", { className: "cls_login_layout_support_links flex flex-col gap-1 text-sm text-muted-foreground", children: [forgot_password_path && forgot_password_label && (_jsx(Link, { href: forgot_password_path, className: "cls_login_layout_forgot_password_link text-primary underline-offset-4 hover:underline", "aria-label": t("login.aria.forgot_password_link"), children: forgot_password_label })), show_create_account_link && create_account_path && create_account_label && (_jsx(Link, { href: create_account_path, className: "cls_login_layout_create_account_link text-primary underline-offset-4 hover:underline", "aria-label": t("login.aria.create_account_link"), children: create_account_label }))] }))] })), show_create_account_link && create_account_path && create_account_label && !oauthConfig.enable_email_password && (oauthConfig.enable_google || oauthConfig.enable_facebook_oauth) && (_jsx("div", { className: "cls_login_layout_support_links mt-4 text-center text-sm text-muted-foreground", children: _jsx(Link, { href: create_account_path, className: "cls_login_layout_create_account_link text-primary underline-offset-4 hover:underline", "aria-label": t("login.aria.create_account_link"), children: create_account_label }) }))] }));
|
|
106
109
|
// Form-only mode: return the content directly. Consumer is expected to wrap
|
|
107
110
|
// it in their own page/brand chrome. We deliberately skip AlreadyLoggedInGuard
|
|
108
111
|
// here — its 2-col fallback would defeat the purpose of form_only. Consumer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connected_accounts_section.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/my_settings/components/connected_accounts_section.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"connected_accounts_section.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/my_settings/components/connected_accounts_section.tsx"],"names":[],"mappings":"AAYA,MAAM,MAAM,6BAA6B,GAAG;IAC1C,0CAA0C;IAC1C,eAAe,EAAE,OAAO,CAAC;IACzB,4DAA4D;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sBAAsB;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oBAAoB;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAGF;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,eAAe,EACf,KAAK,EACL,OAAqD,EACrD,OAAe,GAChB,EAAE,6BAA6B,+BAkD/B"}
|