@protobase/ui 0.25.2 → 0.25.3
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/dist/account/account-pages.js +3 -2
- package/dist/account/account-security-page.js +9 -4
- package/dist/account/backup-codes.js +7 -6
- package/dist/account/messages.js +214 -0
- package/dist/account/passkeys-section.js +23 -22
- package/dist/account/password-dialog.js +3 -2
- package/dist/account/sign-in-policy-form.js +11 -10
- package/dist/account/sign-in-policy-labels.js +30 -29
- package/dist/account/sign-in-policy-page.js +11 -6
- package/dist/account/sign-in-providers-section.js +6 -5
- package/dist/account/staff-sign-in-log.js +11 -10
- package/dist/account/totp-qr.js +2 -1
- package/dist/account/two-factor-section.js +24 -23
- package/dist/account/two-factor-setup.js +18 -17
- package/dist/action-card/action-card.js +2 -1
- package/dist/action-card/messages.js +8 -0
- package/dist/activity-chart/activity-chart.js +3 -2
- package/dist/activity-chart/messages.js +14 -0
- package/dist/app/app.d.ts +1 -1
- package/dist/app/app.js +20 -21
- package/dist/app/assistant-shell.js +2 -1
- package/dist/app/batch-failure.js +2 -1
- package/dist/app/breadcrumb-for.js +4 -3
- package/dist/app/charts/chart-groups.js +3 -2
- package/dist/app/charts/chart-view.js +3 -2
- package/dist/app/charts/group-bars.js +2 -1
- package/dist/app/charts/messages.js +26 -0
- package/dist/app/charts/period-chart.js +3 -2
- package/dist/app/charts/split-points.js +2 -1
- package/dist/app/comments/comment-composer.js +19 -18
- package/dist/app/comments/comments-section.js +4 -3
- package/dist/app/comments/messages.js +26 -0
- package/dist/app/create/create-page.js +11 -18
- package/dist/app/custom-section.js +4 -6
- package/dist/app/displays/board-column.js +6 -5
- package/dist/app/displays/board-columns.js +3 -2
- package/dist/app/displays/board-display.js +13 -15
- package/dist/app/displays/calendar-controls.js +3 -2
- package/dist/app/displays/calendar-display.js +12 -17
- package/dist/app/displays/card-carousel.js +4 -3
- package/dist/app/displays/cards-display.js +2 -1
- package/dist/app/displays/custom-display.js +4 -6
- package/dist/app/displays/display-frame.js +3 -2
- package/dist/app/displays/list-cards.js +5 -8
- package/dist/app/displays/list-displays.js +3 -3
- package/dist/app/displays/map-display.js +15 -14
- package/dist/app/displays/messages.js +128 -2
- package/dist/app/displays/period-controls.js +4 -3
- package/dist/app/displays/record-card.js +7 -6
- package/dist/app/displays/timeline-display.js +17 -26
- package/dist/app/displays/timeline-range.js +2 -1
- package/dist/app/displays/use-board-move.js +2 -2
- package/dist/app/displays/use-calendar-move.js +2 -1
- package/dist/app/document-title.js +2 -1
- package/dist/app/export/builder-port.js +2 -1
- package/dist/app/export/export-dialog.js +36 -40
- package/dist/app/export/export-worker.js +2 -0
- package/dist/app/export/messages.js +78 -0
- package/dist/app/export/run-export.js +5 -2
- package/dist/app/export/sink.js +4 -3
- package/dist/app/export/use-export-flow.js +4 -3
- package/dist/app/field-editor.js +4 -3
- package/dist/app/field-types/messages.js +8 -0
- package/dist/app/field-types/widget-part.js +2 -1
- package/dist/app/file-field.js +11 -14
- package/dist/app/gallery/gallery-section.js +4 -3
- package/dist/app/gallery/lightbox.js +5 -4
- package/dist/app/gallery/messages.js +30 -0
- package/dist/app/gallery/photo-details.js +3 -2
- package/dist/app/hand-order/hand-sorted-list.js +3 -6
- package/dist/app/hand-order/messages.js +4 -2
- package/dist/app/history/describe-change.js +3 -8
- package/dist/app/history/messages.js +32 -0
- package/dist/app/import/convert.js +20 -19
- package/dist/app/import/failed-rows.js +3 -2
- package/dist/app/import/import-button.js +2 -1
- package/dist/app/import/import-check-step.js +19 -35
- package/dist/app/import/import-dialog.js +13 -17
- package/dist/app/import/import-file-step.js +5 -9
- package/dist/app/import/import-mapping-step.js +32 -35
- package/dist/app/import/import-result-step.js +13 -12
- package/dist/app/import/messages.js +200 -0
- package/dist/app/import/parse-worker.js +2 -0
- package/dist/app/import/prepare-rows.js +5 -4
- package/dist/app/import/sheet-cell.js +2 -1
- package/dist/app/import/sheet-file.js +3 -2
- package/dist/app/import/sheet-source.js +7 -3
- package/dist/app/import/xlsx-reader.js +4 -3
- package/dist/app/import/xlsx-xml.js +2 -1
- package/dist/app/import/zip-reader.js +4 -3
- package/dist/app/list-edit/use-list-edits.js +1 -1
- package/dist/app/list-group-chart.js +2 -1
- package/dist/app/list-page.js +1 -1
- package/dist/app/map/map-layer-switch.js +3 -2
- package/dist/app/map/messages.js +14 -0
- package/dist/app/messages.js +116 -2
- package/dist/app/meta-gate.js +1 -1
- package/dist/app/nav-from-meta.js +11 -10
- package/dist/app/pages/action-inputs/action-inputs-dialog.js +3 -2
- package/dist/app/pages/action-inputs/input-answers.js +6 -5
- package/dist/app/pages/blocks/card-row.js +3 -2
- package/dist/app/pages/blocks/modal-form.js +5 -4
- package/dist/app/pages/blocks/record-card.js +3 -2
- package/dist/app/pages/blocks/stat.js +2 -1
- package/dist/app/pages/composed-page.js +6 -8
- package/dist/app/pages/confirm-action.js +2 -1
- package/dist/app/pages/custom-boundary.js +4 -2
- package/dist/app/pages/messages.js +64 -0
- package/dist/app/pages/render-node.js +5 -7
- package/dist/app/pages/use-run-action.js +11 -10
- package/dist/app/record-page.js +1 -1
- package/dist/app/record-row/messages.js +26 -0
- package/dist/app/record-row/record-row-body.js +12 -7
- package/dist/app/record-row/record-row.js +4 -3
- package/dist/app/record-row/saved-record-row.js +3 -2
- package/dist/app/related-dots/dots-summary.js +2 -1
- package/dist/app/related-dots/messages.js +8 -0
- package/dist/app/relation-picker.js +9 -8
- package/dist/app/router.js +5 -4
- package/dist/app/runtime/messages.js +58 -0
- package/dist/app/runtime/runtime-status.js +10 -23
- package/dist/app/runtime/runtime-update-dialog.js +7 -6
- package/dist/app/runtime/runtime-update.js +4 -3
- package/dist/app/saved/favorite-button.js +2 -1
- package/dist/app/saved/messages.js +22 -0
- package/dist/app/saved/saved-list.js +4 -7
- package/dist/app/saved/use-favorite.js +3 -2
- package/dist/app/search/messages.js +6 -2
- package/dist/app/search/navigation-hits.js +9 -7
- package/dist/app/searches/filter-chip-list.js +2 -1
- package/dist/app/searches/messages.js +96 -0
- package/dist/app/searches/save-search-button.js +5 -4
- package/dist/app/searches/saved-search-rows.js +3 -2
- package/dist/app/searches/saved-search-section.js +6 -5
- package/dist/app/searches/saved-search.js +4 -3
- package/dist/app/searches/saved-searches.js +15 -25
- package/dist/app/searches/search-controls.js +5 -4
- package/dist/app/searches/search-diff.js +4 -2
- package/dist/app/searches/search-name-dialog.js +4 -3
- package/dist/app/searches/update-search-dialog.js +15 -30
- package/dist/app/searches/use-save-search.js +8 -7
- package/dist/app/searches/use-search-row.js +4 -3
- package/dist/app/sensitive-field.js +5 -4
- package/dist/app/source-notice.js +13 -8
- package/dist/app/staff-banner.js +12 -19
- package/dist/app-shell/global-search.js +2 -2
- package/dist/app-shell/messages.js +4 -2
- package/dist/assistant-dock/assistant-dock.js +5 -5
- package/dist/assistant-dock/messages.js +26 -0
- package/dist/assistant-dock/use-assistant.js +2 -1
- package/dist/assistant-dock/use-backend-data.js +2 -1
- package/dist/assistant-dock/widget-view.js +3 -2
- package/dist/auth/auth-gate.js +10 -5
- package/dist/auth/auth-locale.js +14 -0
- package/dist/auth/auth-messages.js +122 -43
- package/dist/auth/auth-provider.js +6 -1
- package/dist/auth/code-form.js +2 -1
- package/dist/auth/email-code-form.js +11 -13
- package/dist/auth/email-code-page.js +2 -1
- package/dist/auth/first-run-page.js +6 -5
- package/dist/auth/forgot-password-form.js +14 -16
- package/dist/auth/forgot-password-page.js +2 -1
- package/dist/auth/messages.js +200 -0
- package/dist/auth/provider-sign-in-page.js +5 -5
- package/dist/auth/resend-code-button.js +2 -1
- package/dist/auth/reset-password-form.js +11 -10
- package/dist/auth/reset-password-page.js +4 -3
- package/dist/auth/setup-required-form.js +7 -9
- package/dist/auth/setup-required-page.js +7 -2
- package/dist/auth/sign-in-form.js +15 -18
- package/dist/auth/sign-in-prompt.js +4 -3
- package/dist/auth/sign-up-code-form.js +11 -13
- package/dist/auth/sign-up-details-form.js +14 -21
- package/dist/auth/sign-up-email-form.js +8 -7
- package/dist/auth/sign-up-page.js +2 -1
- package/dist/auth/staff-sign-in-form.js +14 -17
- package/dist/auth/two-factor-form.js +17 -16
- package/dist/auth/user-to-shell.js +2 -1
- package/dist/chat/composer.js +8 -7
- package/dist/chat/messages.js +14 -0
- package/dist/compact-table/compact-table.js +4 -8
- package/dist/compact-table/messages.js +18 -0
- package/dist/data/meta-data.d.ts +1 -1
- package/dist/data/use-update-record.js +1 -1
- package/dist/inline-child-table/inline-child-table.js +12 -12
- package/dist/inline-child-table/line-row.js +10 -9
- package/dist/inline-child-table/messages.js +52 -0
- package/dist/inline-child-table/totals-footer.js +5 -8
- package/dist/invitations/invite-form.js +3 -2
- package/dist/invitations/link-notice.js +6 -4
- package/dist/invitations/messages.js +24 -0
- package/dist/invitations/pending-invitation-row.js +4 -3
- package/dist/lists/messages.js +8 -0
- package/dist/lists/paged-search-list.js +2 -1
- package/dist/locale/slotted.js +14 -0
- package/dist/markdown/markdown-editor.js +6 -5
- package/dist/markdown/messages.js +16 -0
- package/dist/organizations/all-organizations.js +6 -5
- package/dist/organizations/app-roles-picker.js +2 -1
- package/dist/organizations/invitation-page.js +39 -49
- package/dist/organizations/invitations-page.js +11 -10
- package/dist/organizations/members-page.js +15 -10
- package/dist/organizations/messages.js +180 -0
- package/dist/organizations/organization-page.js +27 -26
- package/dist/organizations/organization-paths.js +16 -13
- package/dist/organizations/organization-row.js +3 -2
- package/dist/organizations/organizations-page.js +17 -16
- package/dist/organizations/use-organizations.js +2 -1
- package/dist/package.js +1 -1
- package/dist/plugins/before-sign-in.js +6 -1
- package/dist/plugins/load-plugin.d.ts +1 -1
- package/dist/plugins/load-plugin.js +3 -2
- package/dist/plugins/messages.js +36 -0
- package/dist/plugins/plugin-gate.js +6 -1
- package/dist/plugins/plugin-manifest.js +8 -7
- package/dist/plugins/plugin-notice.js +8 -12
- package/dist/primitives/messages.js +16 -0
- package/dist/primitives/sheet.js +2 -1
- package/dist/primitives/spinner.js +2 -1
- package/dist/primitives/token.js +2 -1
- package/dist/record-view/messages.js +4 -2
- package/dist/record-view/record-tabs.js +2 -1
- package/dist/roles/messages.js +14 -0
- package/dist/roles/use-active-role.js +3 -2
- package/dist/shell/assets/app-CW3U56yM.js +69 -0
- package/dist/shell/assets/cn-Bi0ZEjD9.js +1 -0
- package/dist/shell/assets/export-worker-ClACk00b.js +2 -0
- package/dist/shell/assets/{index-xY0Mvv6V.js → index-B7cIjCuz.js} +2 -2
- package/dist/shell/assets/maplibre-CVG5L9FD.js +814 -0
- package/dist/shell/assets/{markdown-content-ukDTCu6u.js → markdown-content-CtGUP4W6.js} +1 -1
- package/dist/shell/assets/parse-worker-UhbwEjS0.js +5 -0
- package/dist/shell/assets/preload-helper-BX9CcZkY.js +1 -0
- package/dist/shell/assets/{record-map-BJmYZ7kQ.js → record-map-Cw3_NcUl.js} +1 -1
- package/dist/shell/assets/records-map-D4f3ZeDL.js +1 -0
- package/dist/shell/assets/shared-protobase-ui-CB_i50NP.js +1 -0
- package/dist/shell/index.html +5 -3
- package/dist/shell/protobase.shell.json +1 -1
- package/dist/shell/protobase.sw.js +2 -2
- package/dist/side-panel/messages.js +8 -0
- package/dist/side-panel/side-panel.js +2 -1
- package/dist/toasts/messages.js +8 -0
- package/dist/toasts/toast.js +2 -1
- package/dist/users/app-invitations.js +5 -4
- package/dist/users/create-user-form.js +9 -8
- package/dist/users/messages.js +52 -0
- package/dist/users/use-user-roles.js +2 -1
- package/dist/users/user-list.js +6 -5
- package/dist/users/user-row.js +5 -4
- package/package.json +4 -4
- package/dist/shell/assets/app-C-OLrsRR.js +0 -69
- package/dist/shell/assets/export-worker-Bz57Pf5g.js +0 -2
- package/dist/shell/assets/maplibre-Dov6nhPX.js +0 -814
- package/dist/shell/assets/parse-worker-BtcY0dQw.js +0 -5
- package/dist/shell/assets/records-map-C1_gDKHR.js +0 -1
- package/dist/shell/assets/shared-protobase-ui-CFYJAbMR.js +0 -1
|
@@ -1,21 +1,19 @@
|
|
|
1
|
+
import { text } from "./messages.js";
|
|
1
2
|
import { CodeForm } from "./code-form.js";
|
|
2
|
-
import {
|
|
3
|
+
import { slotted } from "../locale/slotted.js";
|
|
4
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
3
5
|
//#region src/auth/email-code-form.tsx
|
|
4
6
|
/** The second half of signing in with an emailed code: the code from the email. */
|
|
5
7
|
const EmailCodeForm = ({ email, onBack, ...rest }) => /* @__PURE__ */ jsx(CodeForm, {
|
|
6
|
-
title: "
|
|
7
|
-
description: "
|
|
8
|
-
explanation: /* @__PURE__ */
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}),
|
|
14
|
-
" has an account, a 6-digit code is on its way. It works for 5 minutes, once."
|
|
15
|
-
] }),
|
|
16
|
-
submitLabel: "Sign in",
|
|
8
|
+
title: text("checkEmail"),
|
|
9
|
+
description: text("signInCodeDescription"),
|
|
10
|
+
explanation: /* @__PURE__ */ jsx(Fragment, { children: slotted(text("signInCodeSent"), /* @__PURE__ */ jsx("span", {
|
|
11
|
+
className: "font-medium text-foreground",
|
|
12
|
+
children: email
|
|
13
|
+
})) }),
|
|
14
|
+
submitLabel: text("signIn"),
|
|
17
15
|
onChangeAddress: onBack,
|
|
18
|
-
changeAddressLabel: "
|
|
16
|
+
changeAddressLabel: text("backToSignIn"),
|
|
19
17
|
...rest
|
|
20
18
|
});
|
|
21
19
|
//#endregion
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { authMessage } from "./auth-messages.js";
|
|
2
|
+
import { text } from "./messages.js";
|
|
2
3
|
import { useAuth } from "./auth-provider.js";
|
|
3
4
|
import { EmailCodeForm } from "./email-code-form.js";
|
|
4
5
|
import { useState } from "react";
|
|
@@ -32,7 +33,7 @@ const EmailCodePage = ({ email, onBack }) => {
|
|
|
32
33
|
onSubmit: (code) => void attempt(() => signInWithCode(email, code)),
|
|
33
34
|
onResend: () => void attempt(async () => {
|
|
34
35
|
await sendSignInCode(email);
|
|
35
|
-
setNotice("
|
|
36
|
+
setNotice(text("newCodeSent"));
|
|
36
37
|
})
|
|
37
38
|
});
|
|
38
39
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { text } from "./messages.js";
|
|
1
2
|
import { Button } from "../primitives/button.js";
|
|
2
3
|
import { AuthLayout } from "./auth-layout.js";
|
|
3
4
|
import { useState } from "react";
|
|
@@ -12,12 +13,12 @@ const createAdminCommand = "protobase users create you@example.com";
|
|
|
12
13
|
const FirstRunPage = ({ command = createAdminCommand, onCheckAgain, busy }) => {
|
|
13
14
|
const [copied, setCopied] = useState(false);
|
|
14
15
|
return /* @__PURE__ */ jsxs(AuthLayout, {
|
|
15
|
-
title: "
|
|
16
|
-
description: "
|
|
16
|
+
title: text("noAdminTitle"),
|
|
17
|
+
description: text("noAdminDescription"),
|
|
17
18
|
children: [
|
|
18
19
|
/* @__PURE__ */ jsx("p", {
|
|
19
20
|
className: "text-muted-foreground",
|
|
20
|
-
children: "
|
|
21
|
+
children: text("noAdminExplanation")
|
|
21
22
|
}),
|
|
22
23
|
/* @__PURE__ */ jsxs("div", {
|
|
23
24
|
className: "mt-4 flex items-center gap-2 rounded-md border bg-surface py-1.5 pl-3 pr-1.5",
|
|
@@ -26,7 +27,7 @@ const FirstRunPage = ({ command = createAdminCommand, onCheckAgain, busy }) => {
|
|
|
26
27
|
children: command
|
|
27
28
|
}), /* @__PURE__ */ jsx("button", {
|
|
28
29
|
type: "button",
|
|
29
|
-
"aria-label": "
|
|
30
|
+
"aria-label": text("copyCommand"),
|
|
30
31
|
onClick: () => {
|
|
31
32
|
navigator.clipboard.writeText(command).then(() => {
|
|
32
33
|
setCopied(true);
|
|
@@ -42,7 +43,7 @@ const FirstRunPage = ({ command = createAdminCommand, onCheckAgain, busy }) => {
|
|
|
42
43
|
className: "mt-4 min-h-10 w-full",
|
|
43
44
|
loading: busy,
|
|
44
45
|
onClick: onCheckAgain,
|
|
45
|
-
children: "
|
|
46
|
+
children: text("reload")
|
|
46
47
|
})
|
|
47
48
|
]
|
|
48
49
|
});
|
|
@@ -1,34 +1,32 @@
|
|
|
1
1
|
import { cn } from "../lib/cn.js";
|
|
2
2
|
import { RouteLink } from "../primitives/route-link.js";
|
|
3
3
|
import { Input } from "../primitives/input.js";
|
|
4
|
+
import { text } from "./messages.js";
|
|
4
5
|
import { Button, buttonClass } from "../primitives/button.js";
|
|
5
6
|
import { AuthLayout } from "./auth-layout.js";
|
|
7
|
+
import { slotted } from "../locale/slotted.js";
|
|
6
8
|
import { useState } from "react";
|
|
7
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
10
|
//#region src/auth/forgot-password-form.tsx
|
|
9
11
|
const ForgotPasswordForm = ({ onSubmit, back, busy, error, sentTo }) => {
|
|
10
12
|
const [email, setEmail] = useState("");
|
|
11
13
|
if (sentTo) return /* @__PURE__ */ jsxs(AuthLayout, {
|
|
12
|
-
title: "
|
|
13
|
-
children: [/* @__PURE__ */
|
|
14
|
+
title: text("checkEmail"),
|
|
15
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
14
16
|
className: "text-muted-foreground",
|
|
15
|
-
children:
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
children: sentTo
|
|
20
|
-
}),
|
|
21
|
-
" has an account, an email with a link to choose a new password is on its way. The link works once, for a limited time."
|
|
22
|
-
]
|
|
17
|
+
children: slotted(text("resetSent"), /* @__PURE__ */ jsx("span", {
|
|
18
|
+
className: "font-medium text-foreground",
|
|
19
|
+
children: sentTo
|
|
20
|
+
}))
|
|
23
21
|
}), /* @__PURE__ */ jsx(RouteLink, {
|
|
24
22
|
to: back,
|
|
25
23
|
className: cn(buttonClass({ variant: "primary" }), "mt-4 min-h-10 w-full"),
|
|
26
|
-
children: "
|
|
24
|
+
children: text("backToSignIn")
|
|
27
25
|
})]
|
|
28
26
|
});
|
|
29
27
|
return /* @__PURE__ */ jsx(AuthLayout, {
|
|
30
|
-
title: "
|
|
31
|
-
description: "
|
|
28
|
+
title: text("resetTitle"),
|
|
29
|
+
description: text("resetDescription"),
|
|
32
30
|
children: /* @__PURE__ */ jsxs("form", {
|
|
33
31
|
className: "flex flex-col gap-4",
|
|
34
32
|
onSubmit: (event) => {
|
|
@@ -38,7 +36,7 @@ const ForgotPasswordForm = ({ onSubmit, back, busy, error, sentTo }) => {
|
|
|
38
36
|
children: [
|
|
39
37
|
/* @__PURE__ */ jsxs("label", {
|
|
40
38
|
className: "flex flex-col gap-1.5 font-medium",
|
|
41
|
-
children: ["
|
|
39
|
+
children: [text("email"), /* @__PURE__ */ jsx(Input, {
|
|
42
40
|
type: "email",
|
|
43
41
|
name: "email",
|
|
44
42
|
autoComplete: "username",
|
|
@@ -60,12 +58,12 @@ const ForgotPasswordForm = ({ onSubmit, back, busy, error, sentTo }) => {
|
|
|
60
58
|
type: "submit",
|
|
61
59
|
loading: busy,
|
|
62
60
|
className: "min-h-10",
|
|
63
|
-
children: "
|
|
61
|
+
children: text("sendResetLink")
|
|
64
62
|
}),
|
|
65
63
|
/* @__PURE__ */ jsx(RouteLink, {
|
|
66
64
|
to: back,
|
|
67
65
|
className: cn(buttonClass({ variant: "ghost" }), "min-h-10"),
|
|
68
|
-
children: "
|
|
66
|
+
children: text("backToSignIn")
|
|
69
67
|
})
|
|
70
68
|
]
|
|
71
69
|
})
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { text } from "./messages.js";
|
|
1
2
|
import { useAuth } from "./auth-provider.js";
|
|
2
3
|
import { ForgotPasswordForm } from "./forgot-password-form.js";
|
|
3
4
|
import { resetLinkTarget } from "./reset-link.js";
|
|
@@ -19,7 +20,7 @@ const ForgotPasswordPage = ({ back }) => {
|
|
|
19
20
|
setSentTo(email);
|
|
20
21
|
} catch (failure) {
|
|
21
22
|
if (!(failure instanceof AuthError)) throw failure;
|
|
22
|
-
setError(failure.status === 429 ? "
|
|
23
|
+
setError(failure.status === 429 ? text("tooManyRequests") : failure.message);
|
|
23
24
|
}
|
|
24
25
|
setBusy(false);
|
|
25
26
|
};
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { defineMessages } from "../locale/messages.js";
|
|
2
|
+
//#region src/auth/messages.ts
|
|
3
|
+
const text = defineMessages({
|
|
4
|
+
en: {
|
|
5
|
+
loading: "Loading",
|
|
6
|
+
cannotReach: (message) => `Cannot reach the server: ${message}`,
|
|
7
|
+
tryAgain: "Try again",
|
|
8
|
+
passwordChanged: "Your password is changed. Sign in with the new one.",
|
|
9
|
+
noAnswer: "The server did not answer",
|
|
10
|
+
code: "Code",
|
|
11
|
+
backupCode: "Backup code",
|
|
12
|
+
email: "Email",
|
|
13
|
+
password: "Password",
|
|
14
|
+
passwordOptional: "Password (optional)",
|
|
15
|
+
signIn: "Sign in",
|
|
16
|
+
signOut: "Sign out",
|
|
17
|
+
continue: "Continue",
|
|
18
|
+
backToSignIn: "Back to sign in",
|
|
19
|
+
useAnotherAddress: "Use another address",
|
|
20
|
+
checkEmail: "Check your email",
|
|
21
|
+
newCodeSent: "A new code is on its way. Only the newest one works.",
|
|
22
|
+
sendNewCode: "Send a new code",
|
|
23
|
+
sendNewCodeIn: (seconds) => `Send a new code in ${seconds}s`,
|
|
24
|
+
signInCodeDescription: "Enter the code we sent to sign in.",
|
|
25
|
+
signInCodeSent: "If {} has an account, a 6-digit code is on its way. It works for 5 minutes, once.",
|
|
26
|
+
signUpCodeDescription: "Enter the code we sent to create your account.",
|
|
27
|
+
signUpCodeSent: "A 6-digit code is on its way to {}. It works for 5 minutes, once. If the address has an account already, the email says so instead.",
|
|
28
|
+
noAdminTitle: "No admin yet",
|
|
29
|
+
noAdminDescription: "This Protobase has no users to sign in with.",
|
|
30
|
+
noAdminExplanation: "Run this in the terminal where Protobase runs, then reload. The first admin is created on the server, not in the browser, so nobody else can claim a fresh URL.",
|
|
31
|
+
copyCommand: "Copy command",
|
|
32
|
+
reload: "Reload",
|
|
33
|
+
tooManyRequests: "Too many requests. Wait a minute and try again.",
|
|
34
|
+
tooManyAttempts: "Too many attempts. Wait a minute and try again.",
|
|
35
|
+
resetTitle: "Reset your password",
|
|
36
|
+
resetDescription: "We email you a link to choose a new one.",
|
|
37
|
+
sendResetLink: "Send reset link",
|
|
38
|
+
resetSent: "If {} has an account, an email with a link to choose a new password is on its way. The link works once, for a limited time.",
|
|
39
|
+
linkExpiredTitle: "This link no longer works",
|
|
40
|
+
linkExpiredExplanation: "A reset link works once, for a limited time. Ask for a new one to choose your password.",
|
|
41
|
+
sendNewLink: "Send a new link",
|
|
42
|
+
passwordsDiffer: "The passwords are not the same.",
|
|
43
|
+
choosePassword: "Choose a new password",
|
|
44
|
+
atLeast: (length) => `At least ${length} characters.`,
|
|
45
|
+
useAtLeast: (length) => `Use at least ${length} characters.`,
|
|
46
|
+
passwordTooLong: "That password is too long.",
|
|
47
|
+
newPassword: "New password",
|
|
48
|
+
repeatPassword: "Repeat new password",
|
|
49
|
+
setPassword: "Set new password",
|
|
50
|
+
signingInWith: (name) => `Signing in with ${name}`,
|
|
51
|
+
takingYouTo: (name) => `Taking you to ${name}…`,
|
|
52
|
+
providerNotOffered: (name) => `Signing in with ${name} is not offered here. Sign in another way.`,
|
|
53
|
+
turnOnTwoFactor: "Turn on two-factor authentication",
|
|
54
|
+
addPasskey: "Add a passkey",
|
|
55
|
+
requiredForEveryAccount: "This app requires it for every account.",
|
|
56
|
+
passkeyExplanation: "A passkey signs you in with Face ID, Touch ID, Windows Hello, your phone or a security key. Your browser asks which one to use.",
|
|
57
|
+
couldNotReadAccount: "Could not read your account",
|
|
58
|
+
signInTitle: "Sign in to Protobase",
|
|
59
|
+
continueWith: (name) => `Continue with ${name}`,
|
|
60
|
+
signInWithPasskey: "Sign in with a passkey",
|
|
61
|
+
passkeyFor: (domain) => `Use a passkey made for ${domain}`,
|
|
62
|
+
or: "or",
|
|
63
|
+
emailSignInCode: "Email me a sign-in code",
|
|
64
|
+
forgotPassword: "Forgot password?",
|
|
65
|
+
newHere: "New here?",
|
|
66
|
+
haveAccount: "Have an account?",
|
|
67
|
+
createAnAccount: "Create an account",
|
|
68
|
+
browse: "Continue without signing in",
|
|
69
|
+
notNow: "Not now",
|
|
70
|
+
detailsTitle: "Your details",
|
|
71
|
+
detailsDescription: "One last step to create your account.",
|
|
72
|
+
yourName: "Your name",
|
|
73
|
+
codeWasRight: "The code was right: the account is for {}.",
|
|
74
|
+
withoutPassword: " Without one, you sign in with a code we email you.",
|
|
75
|
+
createAccount: "Create account",
|
|
76
|
+
codeToConfirm: "We email you a code to make sure the address is yours.",
|
|
77
|
+
emailCode: "Email me a code",
|
|
78
|
+
browseWithoutAccount: "Continue without an account",
|
|
79
|
+
staffTitle: "Staff sign-in",
|
|
80
|
+
staffUnavailable: "Staff of the team that runs this app cannot sign in as people here.",
|
|
81
|
+
signInAsPerson: "Sign in as a person",
|
|
82
|
+
forStaffOf: (operator) => `For staff of ${operator}, to help someone with this app.`,
|
|
83
|
+
theirEmail: "Their email",
|
|
84
|
+
reason: "Reason",
|
|
85
|
+
reasonExample: "Ticket 4211: the invoice totals look wrong",
|
|
86
|
+
staffExplanation: (operator) => `You sign in at ${operator} with a passkey or a second step. The session is short, shows a banner, and cannot change their sign-in. The app's admins see who signed in as whom, and why.`,
|
|
87
|
+
totpInstruction: "Enter the 6-digit code from your authenticator app.",
|
|
88
|
+
otpInstruction: "Enter the 6-digit code we emailed you. It works for 5 minutes.",
|
|
89
|
+
backupInstruction: "Enter one of the backup codes you saved when you set up the authenticator app. Each works once.",
|
|
90
|
+
twoFactorTitle: "Two-factor authentication",
|
|
91
|
+
twoFactorDescription: "One more step to sign in.",
|
|
92
|
+
codeToFinish: "We email you a code to finish signing in.",
|
|
93
|
+
trustBrowser: "Trust this browser",
|
|
94
|
+
trustBrowserFor: "Don't ask again in this browser for 30 days",
|
|
95
|
+
verify: "Verify",
|
|
96
|
+
useAuthenticator: "Use the authenticator app",
|
|
97
|
+
emailCodeInstead: "Email me a code instead",
|
|
98
|
+
useBackupCode: "Use a backup code",
|
|
99
|
+
admin: "Admin"
|
|
100
|
+
},
|
|
101
|
+
nl: {
|
|
102
|
+
loading: "Laden",
|
|
103
|
+
cannotReach: (message) => `Kan de server niet bereiken: ${message}`,
|
|
104
|
+
tryAgain: "Opnieuw proberen",
|
|
105
|
+
passwordChanged: "Je wachtwoord is gewijzigd. Log in met het nieuwe.",
|
|
106
|
+
noAnswer: "De server antwoordde niet",
|
|
107
|
+
code: "Code",
|
|
108
|
+
backupCode: "Back-upcode",
|
|
109
|
+
email: "E-mailadres",
|
|
110
|
+
password: "Wachtwoord",
|
|
111
|
+
passwordOptional: "Wachtwoord (optioneel)",
|
|
112
|
+
signIn: "Inloggen",
|
|
113
|
+
signOut: "Uitloggen",
|
|
114
|
+
continue: "Doorgaan",
|
|
115
|
+
backToSignIn: "Terug naar inloggen",
|
|
116
|
+
useAnotherAddress: "Een ander adres gebruiken",
|
|
117
|
+
checkEmail: "Kijk in je e-mail",
|
|
118
|
+
newCodeSent: "Er is een nieuwe code onderweg. Alleen de nieuwste werkt.",
|
|
119
|
+
sendNewCode: "Nieuwe code sturen",
|
|
120
|
+
sendNewCodeIn: (seconds) => `Nieuwe code sturen over ${seconds}s`,
|
|
121
|
+
signInCodeDescription: "Vul de code in die we stuurden om in te loggen.",
|
|
122
|
+
signInCodeSent: "Als {} een account heeft, is er een code van 6 cijfers onderweg. Die werkt 5 minuten, één keer.",
|
|
123
|
+
signUpCodeDescription: "Vul de code in die we stuurden om je account te maken.",
|
|
124
|
+
signUpCodeSent: "Er is een code van 6 cijfers onderweg naar {}. Die werkt 5 minuten, één keer. Heeft het adres al een account, dan staat dat in de e-mail.",
|
|
125
|
+
noAdminTitle: "Nog geen beheerder",
|
|
126
|
+
noAdminDescription: "Deze Protobase heeft geen gebruikers om mee in te loggen.",
|
|
127
|
+
noAdminExplanation: "Voer dit uit in de terminal waar Protobase draait en laad de pagina daarna opnieuw. De eerste beheerder wordt op de server gemaakt, niet in de browser, zodat niemand anders een nieuwe URL kan opeisen.",
|
|
128
|
+
copyCommand: "Opdracht kopiëren",
|
|
129
|
+
reload: "Opnieuw laden",
|
|
130
|
+
tooManyRequests: "Te veel verzoeken. Wacht een minuut en probeer het opnieuw.",
|
|
131
|
+
tooManyAttempts: "Te veel pogingen. Wacht een minuut en probeer het opnieuw.",
|
|
132
|
+
resetTitle: "Je wachtwoord herstellen",
|
|
133
|
+
resetDescription: "We mailen je een link om een nieuw te kiezen.",
|
|
134
|
+
sendResetLink: "Herstellink sturen",
|
|
135
|
+
resetSent: "Als {} een account heeft, is er een e-mail onderweg met een link om een nieuw wachtwoord te kiezen. De link werkt één keer, een beperkte tijd.",
|
|
136
|
+
linkExpiredTitle: "Deze link werkt niet meer",
|
|
137
|
+
linkExpiredExplanation: "Een herstellink werkt één keer, een beperkte tijd. Vraag een nieuwe aan om je wachtwoord te kiezen.",
|
|
138
|
+
sendNewLink: "Nieuwe link sturen",
|
|
139
|
+
passwordsDiffer: "De wachtwoorden zijn niet hetzelfde.",
|
|
140
|
+
choosePassword: "Kies een nieuw wachtwoord",
|
|
141
|
+
atLeast: (length) => `Minstens ${length} tekens.`,
|
|
142
|
+
useAtLeast: (length) => `Gebruik minstens ${length} tekens.`,
|
|
143
|
+
passwordTooLong: "Dat wachtwoord is te lang.",
|
|
144
|
+
newPassword: "Nieuw wachtwoord",
|
|
145
|
+
repeatPassword: "Nieuw wachtwoord herhalen",
|
|
146
|
+
setPassword: "Nieuw wachtwoord instellen",
|
|
147
|
+
signingInWith: (name) => `Inloggen met ${name}`,
|
|
148
|
+
takingYouTo: (name) => `Je gaat naar ${name}…`,
|
|
149
|
+
providerNotOffered: (name) => `Inloggen met ${name} kan hier niet. Log op een andere manier in.`,
|
|
150
|
+
turnOnTwoFactor: "Tweestapsverificatie aanzetten",
|
|
151
|
+
addPasskey: "Passkey toevoegen",
|
|
152
|
+
requiredForEveryAccount: "Deze app vraagt het voor elk account.",
|
|
153
|
+
passkeyExplanation: "Met een passkey log je in met Face ID, Touch ID, Windows Hello, je telefoon of een beveiligingssleutel. Je browser vraagt welke je gebruikt.",
|
|
154
|
+
couldNotReadAccount: "Kon je account niet lezen",
|
|
155
|
+
signInTitle: "Inloggen bij Protobase",
|
|
156
|
+
continueWith: (name) => `Doorgaan met ${name}`,
|
|
157
|
+
signInWithPasskey: "Inloggen met een passkey",
|
|
158
|
+
passkeyFor: (domain) => `Een passkey voor ${domain} gebruiken`,
|
|
159
|
+
or: "of",
|
|
160
|
+
emailSignInCode: "Mail me een inlogcode",
|
|
161
|
+
forgotPassword: "Wachtwoord vergeten?",
|
|
162
|
+
newHere: "Nieuw hier?",
|
|
163
|
+
haveAccount: "Heb je een account?",
|
|
164
|
+
createAnAccount: "Account maken",
|
|
165
|
+
browse: "Doorgaan zonder in te loggen",
|
|
166
|
+
notNow: "Niet nu",
|
|
167
|
+
detailsTitle: "Je gegevens",
|
|
168
|
+
detailsDescription: "Nog één stap om je account te maken.",
|
|
169
|
+
yourName: "Je naam",
|
|
170
|
+
codeWasRight: "De code klopte: het account is voor {}.",
|
|
171
|
+
withoutPassword: " Zonder wachtwoord log je in met een code die we je mailen.",
|
|
172
|
+
createAccount: "Account maken",
|
|
173
|
+
codeToConfirm: "We mailen je een code om te controleren dat het adres van jou is.",
|
|
174
|
+
emailCode: "Mail me een code",
|
|
175
|
+
browseWithoutAccount: "Doorgaan zonder account",
|
|
176
|
+
staffTitle: "Inloggen als medewerker",
|
|
177
|
+
staffUnavailable: "Medewerkers van het team dat deze app beheert, kunnen hier niet als iemand anders inloggen.",
|
|
178
|
+
signInAsPerson: "Inloggen als iemand anders",
|
|
179
|
+
forStaffOf: (operator) => `Voor medewerkers van ${operator}, om iemand met deze app te helpen.`,
|
|
180
|
+
theirEmail: "Hun e-mailadres",
|
|
181
|
+
reason: "Reden",
|
|
182
|
+
reasonExample: "Ticket 4211: de factuurtotalen kloppen niet",
|
|
183
|
+
staffExplanation: (operator) => `Je logt in bij ${operator} met een passkey of een tweede stap. De sessie is kort, toont een balk en kan hun inlog niet wijzigen. De beheerders van de app zien wie als wie inlogde, en waarom.`,
|
|
184
|
+
totpInstruction: "Vul de code van 6 cijfers uit je authenticator-app in.",
|
|
185
|
+
otpInstruction: "Vul de code van 6 cijfers in die we je mailden. Die werkt 5 minuten.",
|
|
186
|
+
backupInstruction: "Vul een van de back-upcodes in die je bewaarde toen je de authenticator-app instelde. Elke code werkt één keer.",
|
|
187
|
+
twoFactorTitle: "Tweestapsverificatie",
|
|
188
|
+
twoFactorDescription: "Nog één stap om in te loggen.",
|
|
189
|
+
codeToFinish: "We mailen je een code om het inloggen af te ronden.",
|
|
190
|
+
trustBrowser: "Deze browser vertrouwen",
|
|
191
|
+
trustBrowserFor: "Niet meer vragen in deze browser, 30 dagen lang",
|
|
192
|
+
verify: "Controleren",
|
|
193
|
+
useAuthenticator: "De authenticator-app gebruiken",
|
|
194
|
+
emailCodeInstead: "Mail me liever een code",
|
|
195
|
+
useBackupCode: "Een back-upcode gebruiken",
|
|
196
|
+
admin: "Beheerder"
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
//#endregion
|
|
200
|
+
export { text };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Spinner } from "../primitives/spinner.js";
|
|
2
2
|
import { signInMessage } from "./auth-messages.js";
|
|
3
3
|
import { providerName } from "./provider-link.js";
|
|
4
|
+
import { text } from "./messages.js";
|
|
4
5
|
import { useAuth } from "./auth-provider.js";
|
|
5
6
|
import { AuthLayout } from "./auth-layout.js";
|
|
6
7
|
import { useEffect, useRef } from "react";
|
|
@@ -9,16 +10,15 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
9
10
|
//#region src/auth/provider-sign-in-page.tsx
|
|
10
11
|
/** What the page shows while the browser leaves for the provider `name`. */
|
|
11
12
|
const ProviderRedirect = ({ name, workspace }) => /* @__PURE__ */ jsx(AuthLayout, {
|
|
12
|
-
title:
|
|
13
|
+
title: text("signingInWith", name),
|
|
13
14
|
description: workspace,
|
|
14
15
|
children: /* @__PURE__ */ jsxs("p", {
|
|
15
16
|
role: "status",
|
|
16
17
|
className: "flex items-center justify-center gap-2 text-muted-foreground",
|
|
17
18
|
children: [
|
|
18
19
|
/* @__PURE__ */ jsx(Spinner, {}),
|
|
19
|
-
"
|
|
20
|
-
name
|
|
21
|
-
"…"
|
|
20
|
+
" ",
|
|
21
|
+
text("takingYouTo", name)
|
|
22
22
|
]
|
|
23
23
|
})
|
|
24
24
|
});
|
|
@@ -34,7 +34,7 @@ const ProviderSignInPage = ({ provider, workspace, onFailed }) => {
|
|
|
34
34
|
useEffect(() => {
|
|
35
35
|
if (started.current) return;
|
|
36
36
|
started.current = true;
|
|
37
|
-
if (!offered) return onFailed(
|
|
37
|
+
if (!offered) return onFailed(text("providerNotOffered", name));
|
|
38
38
|
signInSocial(provider).catch((failure) => {
|
|
39
39
|
if (!(failure instanceof AuthError)) throw failure;
|
|
40
40
|
onFailed(signInMessage(failure));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { text } from "./messages.js";
|
|
1
2
|
import { Button } from "../primitives/button.js";
|
|
2
3
|
import { useEffect, useState } from "react";
|
|
3
4
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -22,7 +23,7 @@ const ResendCodeButton = ({ onResend, cooldown = 30, disabled }) => {
|
|
|
22
23
|
onResend();
|
|
23
24
|
},
|
|
24
25
|
className: "min-h-10",
|
|
25
|
-
children: left > 0 ?
|
|
26
|
+
children: left > 0 ? text("sendNewCodeIn", left) : text("sendNewCode")
|
|
26
27
|
});
|
|
27
28
|
};
|
|
28
29
|
//#endregion
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Input } from "../primitives/input.js";
|
|
2
|
+
import { text } from "./messages.js";
|
|
2
3
|
import { Button } from "../primitives/button.js";
|
|
3
4
|
import { AuthLayout } from "./auth-layout.js";
|
|
4
5
|
import { useState } from "react";
|
|
@@ -8,29 +9,29 @@ const ResetPasswordForm = ({ onSubmit, invalidLink, onRequestNewLink, onBack, bu
|
|
|
8
9
|
const [repeat, setRepeat] = useState("");
|
|
9
10
|
const [mismatch, setMismatch] = useState(false);
|
|
10
11
|
if (invalidLink) return /* @__PURE__ */ jsxs(AuthLayout, {
|
|
11
|
-
title: "
|
|
12
|
+
title: text("linkExpiredTitle"),
|
|
12
13
|
children: [/* @__PURE__ */ jsx("p", {
|
|
13
14
|
className: "text-muted-foreground",
|
|
14
|
-
children: "
|
|
15
|
+
children: text("linkExpiredExplanation")
|
|
15
16
|
}), /* @__PURE__ */ jsxs("div", {
|
|
16
17
|
className: "mt-4 flex flex-col gap-2",
|
|
17
18
|
children: [onRequestNewLink && /* @__PURE__ */ jsx(Button, {
|
|
18
19
|
variant: "primary",
|
|
19
20
|
className: "min-h-10",
|
|
20
21
|
onClick: onRequestNewLink,
|
|
21
|
-
children: "
|
|
22
|
+
children: text("sendNewLink")
|
|
22
23
|
}), /* @__PURE__ */ jsx(Button, {
|
|
23
24
|
variant: onRequestNewLink ? "ghost" : "primary",
|
|
24
25
|
className: "min-h-10",
|
|
25
26
|
onClick: onBack,
|
|
26
|
-
children: "
|
|
27
|
+
children: text("backToSignIn")
|
|
27
28
|
})]
|
|
28
29
|
})]
|
|
29
30
|
});
|
|
30
|
-
const shown = mismatch ? "
|
|
31
|
+
const shown = mismatch ? text("passwordsDiffer") : error;
|
|
31
32
|
return /* @__PURE__ */ jsx(AuthLayout, {
|
|
32
|
-
title: "
|
|
33
|
-
description:
|
|
33
|
+
title: text("choosePassword"),
|
|
34
|
+
description: text("atLeast", 12),
|
|
34
35
|
children: /* @__PURE__ */ jsxs("form", {
|
|
35
36
|
className: "flex flex-col gap-4",
|
|
36
37
|
onSubmit: (event) => {
|
|
@@ -41,7 +42,7 @@ const ResetPasswordForm = ({ onSubmit, invalidLink, onRequestNewLink, onBack, bu
|
|
|
41
42
|
children: [
|
|
42
43
|
/* @__PURE__ */ jsxs("label", {
|
|
43
44
|
className: "flex flex-col gap-1.5 font-medium",
|
|
44
|
-
children: ["
|
|
45
|
+
children: [text("newPassword"), /* @__PURE__ */ jsx(Input, {
|
|
45
46
|
type: "password",
|
|
46
47
|
name: "new-password",
|
|
47
48
|
autoComplete: "new-password",
|
|
@@ -56,7 +57,7 @@ const ResetPasswordForm = ({ onSubmit, invalidLink, onRequestNewLink, onBack, bu
|
|
|
56
57
|
}),
|
|
57
58
|
/* @__PURE__ */ jsxs("label", {
|
|
58
59
|
className: "flex flex-col gap-1.5 font-medium",
|
|
59
|
-
children: ["
|
|
60
|
+
children: [text("repeatPassword"), /* @__PURE__ */ jsx(Input, {
|
|
60
61
|
type: "password",
|
|
61
62
|
name: "repeat-password",
|
|
62
63
|
autoComplete: "new-password",
|
|
@@ -78,7 +79,7 @@ const ResetPasswordForm = ({ onSubmit, invalidLink, onRequestNewLink, onBack, bu
|
|
|
78
79
|
type: "submit",
|
|
79
80
|
loading: busy,
|
|
80
81
|
className: "min-h-10",
|
|
81
|
-
children: "
|
|
82
|
+
children: text("setPassword")
|
|
82
83
|
})
|
|
83
84
|
]
|
|
84
85
|
})
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { text } from "./messages.js";
|
|
1
2
|
import { useAuth } from "./auth-provider.js";
|
|
2
3
|
import { ResetPasswordForm } from "./reset-password-form.js";
|
|
3
4
|
import { useState } from "react";
|
|
@@ -6,9 +7,9 @@ import { jsx } from "react/jsx-runtime";
|
|
|
6
7
|
//#region src/auth/reset-password-page.tsx
|
|
7
8
|
/** Better Auth's answers to a new password, in words for the person at the keyboard. */
|
|
8
9
|
const resetPasswordMessage = (error) => {
|
|
9
|
-
if (error.status === 429) return "
|
|
10
|
-
if (error.code === "PASSWORD_TOO_SHORT") return
|
|
11
|
-
if (error.code === "PASSWORD_TOO_LONG") return "
|
|
10
|
+
if (error.status === 429) return text("tooManyAttempts");
|
|
11
|
+
if (error.code === "PASSWORD_TOO_SHORT") return text("useAtLeast", 12);
|
|
12
|
+
if (error.code === "PASSWORD_TOO_LONG") return text("passwordTooLong");
|
|
12
13
|
return error.message;
|
|
13
14
|
};
|
|
14
15
|
/** Sets a new password with the token of an emailed reset link. */
|
|
@@ -1,23 +1,21 @@
|
|
|
1
|
+
import { text } from "./messages.js";
|
|
1
2
|
import { Button } from "../primitives/button.js";
|
|
2
3
|
import { TwoFactorSetup } from "../account/two-factor-setup.js";
|
|
3
4
|
import { AuthLayout } from "./auth-layout.js";
|
|
4
5
|
import { KeyRound } from "lucide-react";
|
|
5
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
7
|
//#region src/auth/setup-required-form.tsx
|
|
7
|
-
const
|
|
8
|
-
twoFactor: "Turn on two-factor authentication",
|
|
9
|
-
passkey: "Add a passkey"
|
|
10
|
-
};
|
|
8
|
+
const title = (step) => step === "twoFactor" ? text("turnOnTwoFactor") : text("addPasskey");
|
|
11
9
|
/** Shown after signing in while the account lacks something the sign-in policy requires; the app opens once it is set up. */
|
|
12
10
|
const SetupRequiredForm = ({ step, twoFactor, onAddPasskey, busy, error, onSignOut }) => /* @__PURE__ */ jsxs(AuthLayout, {
|
|
13
|
-
title:
|
|
14
|
-
description: "
|
|
11
|
+
title: title(step),
|
|
12
|
+
description: text("requiredForEveryAccount"),
|
|
15
13
|
children: [step === "twoFactor" ? /* @__PURE__ */ jsx(TwoFactorSetup, { ...twoFactor }) : /* @__PURE__ */ jsxs("div", {
|
|
16
14
|
className: "flex flex-col gap-4",
|
|
17
15
|
children: [
|
|
18
16
|
/* @__PURE__ */ jsx("p", {
|
|
19
17
|
className: "text-muted-foreground",
|
|
20
|
-
children: "
|
|
18
|
+
children: text("passkeyExplanation")
|
|
21
19
|
}),
|
|
22
20
|
error && /* @__PURE__ */ jsx("p", {
|
|
23
21
|
role: "alert",
|
|
@@ -29,14 +27,14 @@ const SetupRequiredForm = ({ step, twoFactor, onAddPasskey, busy, error, onSignO
|
|
|
29
27
|
loading: busy,
|
|
30
28
|
onClick: onAddPasskey,
|
|
31
29
|
className: "min-h-10",
|
|
32
|
-
children: [/* @__PURE__ */ jsx(KeyRound, { className: "size-4" }), "
|
|
30
|
+
children: [/* @__PURE__ */ jsx(KeyRound, { className: "size-4" }), text("addPasskey")]
|
|
33
31
|
})
|
|
34
32
|
]
|
|
35
33
|
}), /* @__PURE__ */ jsx("button", {
|
|
36
34
|
type: "button",
|
|
37
35
|
onClick: onSignOut,
|
|
38
36
|
className: "mt-4 w-full text-center font-medium text-muted-foreground hover:underline",
|
|
39
|
-
children: "
|
|
37
|
+
children: text("signOut")
|
|
40
38
|
})]
|
|
41
39
|
});
|
|
42
40
|
//#endregion
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Spinner } from "../primitives/spinner.js";
|
|
2
2
|
import { authMessage } from "./auth-messages.js";
|
|
3
|
+
import { text } from "./messages.js";
|
|
3
4
|
import { useAuth } from "./auth-provider.js";
|
|
4
5
|
import { SetupRequiredForm } from "./setup-required-form.js";
|
|
5
6
|
import { useEffect, useState } from "react";
|
|
@@ -13,7 +14,7 @@ const SetupRequiredPage = ({ missing }) => {
|
|
|
13
14
|
const [busy, setBusy] = useState(false);
|
|
14
15
|
const [error, setError] = useState();
|
|
15
16
|
useEffect(() => {
|
|
16
|
-
session.account.signInMethods().then(setMethods, (failure) => setError(failure instanceof AuthError ? authMessage(failure) : "
|
|
17
|
+
session.account.signInMethods().then(setMethods, (failure) => setError(failure instanceof AuthError ? authMessage(failure) : text("couldNotReadAccount")));
|
|
17
18
|
}, [session]);
|
|
18
19
|
const addPasskey = async () => {
|
|
19
20
|
setBusy(true);
|
|
@@ -29,7 +30,11 @@ const SetupRequiredPage = ({ missing }) => {
|
|
|
29
30
|
};
|
|
30
31
|
if (!methods && !error) return /* @__PURE__ */ jsxs("div", {
|
|
31
32
|
className: "flex h-full min-h-48 items-center justify-center gap-2 text-muted-foreground",
|
|
32
|
-
children: [
|
|
33
|
+
children: [
|
|
34
|
+
/* @__PURE__ */ jsx(Spinner, {}),
|
|
35
|
+
" ",
|
|
36
|
+
text("loading")
|
|
37
|
+
]
|
|
33
38
|
});
|
|
34
39
|
return /* @__PURE__ */ jsx(SetupRequiredForm, {
|
|
35
40
|
step: missing[0],
|