@nocobase/portal-template-default 1.0.14 → 1.0.16
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/assets/{LineDraw-iG-ADes-.js → LineDraw-vPRTWiQ5.js} +1 -1
- package/dist/assets/{SymbolDraw-DXoSw1tM.js → SymbolDraw-DOl_Tss3.js} +1 -1
- package/dist/assets/{VisualMapping-C_ee4Eht.js → VisualMapping-j08W3KBm.js} +1 -1
- package/dist/assets/{auth-method-demo-DaOCuvsq.js → auth-method-demo-B2qcpY8z.js} +1 -1
- package/dist/assets/auto-login-provider-BMtzvdxG.js +1 -0
- package/dist/assets/{auto-login-provider-5Uxza9Ms.js → auto-login-provider-Bukw7zEe.js} +2 -2
- package/dist/assets/auto-redirect-provider-C6GNPg5r.js +1 -0
- package/dist/assets/auto-redirect-provider-D5c6kN2R.js +1 -0
- package/dist/assets/{auto-redirect-provider-CfwRvYOI.js → auto-redirect-provider-iTzGEDpU.js} +1 -1
- package/dist/assets/{calendar-DjDRfD5t.js → calendar-Dv2RNnsr.js} +1 -1
- package/dist/assets/{card-DuQBOS6A.js → card-C9Hpeq1c.js} +1 -1
- package/dist/assets/{cas-sign-in-button-CyqG1QME.js → cas-sign-in-button-BQn3Mttx.js} +1 -1
- package/dist/assets/{components-D-ptYjX_.js → components-BT5mL9gW.js} +1 -1
- package/dist/assets/{configuration-gate-C08mkkiX.js → configuration-gate-BJoadoA6.js} +1 -1
- package/dist/assets/{createClipPathFromCoordSys-wj34-b1B.js → createClipPathFromCoordSys-m8IbnJ1z.js} +1 -1
- package/dist/assets/createSeriesDataSimply-DKUV5b5e.js +1 -0
- package/dist/assets/{customGraphicKeyframeAnimation-DWrhrHL_.js → customGraphicKeyframeAnimation-CYLPurwK.js} +1 -1
- package/dist/assets/{demo-DkIhyiRK.js → demo-BWGOwqtJ.js} +1 -1
- package/dist/assets/{demo-D4OiKplc.js → demo-BWbcvkya.js} +1 -1
- package/dist/assets/{demo-BYWHeKUe.js → demo-DIASSPgn.js} +1 -1
- package/dist/assets/{demo-DBueJg0m.js → demo-DuZ6asUU.js} +1 -1
- package/dist/assets/{demo-CPWoNtx8.js → demo-Dxcy4bDE.js} +1 -1
- package/dist/assets/{demo-CyvJk5zV.js → demo-YpEC76uw.js} +1 -1
- package/dist/assets/{demo-tpTjO0sC.js → demo-wzkoR8T2.js} +1 -1
- package/dist/assets/{dingtalk-sign-in-button-DSWsSruv.js → dingtalk-sign-in-button-DSluFaP9.js} +1 -1
- package/dist/assets/{echarts-preview-DxHNfq1C.js → echarts-preview-mRXoEciY.js} +1 -1
- package/dist/assets/{echarts-runtime-D8kXn6ME.js → echarts-runtime-CvLr4Slh.js} +3 -3
- package/dist/assets/{echarts-runtime-advanced-QY8v95qK.js → echarts-runtime-advanced-BC1tvfQ0.js} +1 -1
- package/dist/assets/{echarts-runtime-common-D-yqAK-r.js → echarts-runtime-common-DhNaV5B8.js} +1 -1
- package/dist/assets/{echarts-runtime-components-P4-i8jPU.js → echarts-runtime-components-BiioS8t1.js} +1 -1
- package/dist/assets/{echarts-runtime-hierarchy-ByQZ-DbP.js → echarts-runtime-hierarchy-CAWqYvFh.js} +1 -1
- package/dist/assets/{floating-BFVEyPEp.js → floating-RVbHvIiD.js} +1 -1
- package/dist/assets/{index-um5hdKdZ.js → index-BysibBZu.js} +1 -1
- package/dist/assets/{index-CwNxd66J.js → index-C-tdHirk.js} +1 -1
- package/dist/assets/{index-gFtCXH3o.js → index-CBZbj45X.js} +1 -1
- package/dist/assets/index-CgkdZ6Oc.js +686 -0
- package/dist/assets/{index-Btk35Nx-.js → index-Dw20Lzpp.js} +3 -3
- package/dist/assets/{index-BgCbGDMc.js → index-hSBzW-VA.js} +1 -1
- package/dist/assets/{labelHelper-DQqRy3a_.js → labelHelper-DbITmOUW.js} +1 -1
- package/dist/assets/{ldap-sign-in-form--6Gt3yGq.js → ldap-sign-in-form-BOMNDTkK.js} +1 -1
- package/dist/assets/{oidc-sign-in-button-CQdRcR_p.js → oidc-sign-in-button-Cgpa8Qzj.js} +1 -1
- package/dist/assets/{page-context-CnQ4GYM7.js → page-context-AU6RU0Qi.js} +4 -4
- package/dist/assets/prompt-card-FWugRgi-.js +1 -0
- package/dist/assets/{prompt-output-DZHRM2ft.js → prompt-output-DMTuTNab.js} +1 -1
- package/dist/assets/{saml-sign-in-button-BHL5a0JV.js → saml-sign-in-button-qt8bMeoQ.js} +1 -1
- package/dist/assets/{sectorHelper-DN_Vv6OL.js → sectorHelper-C6L782Ue.js} +1 -1
- package/dist/assets/shortcut-Bu7jT_-w.js +47 -0
- package/dist/assets/{sms-sign-in-form-DTX9GV2I.js → sms-sign-in-form-Bo2WLZuP.js} +1 -1
- package/dist/assets/{static.browser-jI1psK0d.js → static.browser-CoPxsICt.js} +8 -8
- package/dist/assets/switch-DQkkIE7G.js +1 -0
- package/dist/assets/{tool-cards-DFttLAfo.js → tool-cards-ipgJ_3Ec.js} +1 -1
- package/dist/assets/{use-authenticator-sign-in-CRGjzXju.js → use-authenticator-sign-in-BzFeh7qe.js} +1 -1
- package/dist/assets/{use-dingtalk-sign-in-8WYzJ2jf.js → use-dingtalk-sign-in-mrq6K5Yx.js} +1 -1
- package/dist/assets/{use-wecom-sign-in-C9j8wfCD.js → use-wecom-sign-in-PPIMLvGa.js} +1 -1
- package/dist/assets/wecom-sign-in-button-rUq9RW8R.js +1 -0
- package/dist/index.html +1 -1
- package/dist/index.raw.html +1 -1
- package/package.json +1 -1
- package/scripts/build-html.mjs +59 -2
- package/src/components/auth/sign-up-form.tsx +287 -59
- package/src/components/auth/types.ts +23 -1
- package/dist/assets/auto-login-provider-DyaPGK2D.js +0 -1
- package/dist/assets/auto-redirect-provider-Cr3jmYts.js +0 -1
- package/dist/assets/auto-redirect-provider-QkJQRBbG.js +0 -1
- package/dist/assets/createSeriesDataSimply-D0A6SAVQ.js +0 -1
- package/dist/assets/index-MB-jfQld.js +0 -686
- package/dist/assets/prompt-card-B2RS4nt2.js +0 -1
- package/dist/assets/shortcut-C5x5LQWU.js +0 -47
- package/dist/assets/switch-CRL8PmRI.js +0 -1
- package/dist/assets/wecom-sign-in-button-mIS1zGSU.js +0 -1
package/scripts/build-html.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
|
-
import
|
|
4
|
+
import * as util from "node:util";
|
|
5
5
|
|
|
6
6
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
7
7
|
const rootDir = path.resolve(__dirname, "..");
|
|
@@ -12,9 +12,66 @@ const indexPath = path.join(distDir, "index.html");
|
|
|
12
12
|
const startMarker = "<!-- nocobase-runtime-config:start -->";
|
|
13
13
|
const endMarker = "<!-- nocobase-runtime-config:end -->";
|
|
14
14
|
|
|
15
|
+
const parseEnv = (content) => {
|
|
16
|
+
if (typeof util.parseEnv === "function") return util.parseEnv(content);
|
|
17
|
+
|
|
18
|
+
const parsed = {};
|
|
19
|
+
const linePattern =
|
|
20
|
+
/^\s*(?:export\s+)?([\w.-]+)\s*=\s*('(?:\\'|[^'])*'|"(?:\\"|[^"])*"|[^#\r\n]*)?\s*(?:#.*)?$/;
|
|
21
|
+
|
|
22
|
+
for (const line of content.split(/\r?\n/)) {
|
|
23
|
+
const match = line.match(linePattern);
|
|
24
|
+
if (!match) continue;
|
|
25
|
+
|
|
26
|
+
const [, key, rawValue = ""] = match;
|
|
27
|
+
const quote = rawValue[0];
|
|
28
|
+
let value = rawValue.trim();
|
|
29
|
+
|
|
30
|
+
if (
|
|
31
|
+
(quote === '"' || quote === "'") &&
|
|
32
|
+
value.endsWith(quote) &&
|
|
33
|
+
value.length >= 2
|
|
34
|
+
) {
|
|
35
|
+
value = value.slice(1, -1);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
parsed[key] = value.replace(/\\n/g, "\n").replace(/\\r/g, "\r");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return parsed;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const expandEnvValue = (value, env) =>
|
|
45
|
+
value.replace(/\\?\${?([A-Za-z_][A-Za-z0-9_]*)}?/g, (match, key) => {
|
|
46
|
+
if (match.startsWith("\\")) return match.slice(1);
|
|
47
|
+
return env[key] ?? "";
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const getEnvFilesForMode = (mode) => {
|
|
51
|
+
if (mode === "local") {
|
|
52
|
+
throw new Error(
|
|
53
|
+
'"local" cannot be used as a mode name because it conflicts with .env.local.'
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return [".env", ".env.local", `.env.${mode}`, `.env.${mode}.local`].map(
|
|
58
|
+
(file) => path.join(rootDir, file)
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
15
62
|
const loadBuildHtmlEnv = () => {
|
|
16
63
|
const mode = process.env.MODE || "production";
|
|
17
|
-
const env =
|
|
64
|
+
const env = {};
|
|
65
|
+
|
|
66
|
+
for (const envFile of getEnvFilesForMode(mode)) {
|
|
67
|
+
if (!fs.existsSync(envFile)) continue;
|
|
68
|
+
Object.assign(env, parseEnv(fs.readFileSync(envFile, "utf8")));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const expansionEnv = { ...env, ...process.env };
|
|
72
|
+
for (const [key, value] of Object.entries(env)) {
|
|
73
|
+
env[key] = expandEnvValue(value, expansionEnv);
|
|
74
|
+
}
|
|
18
75
|
|
|
19
76
|
for (const [key, value] of Object.entries(env)) {
|
|
20
77
|
if (process.env[key] === undefined) {
|
|
@@ -1,27 +1,201 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
+
import { AlertCircle, KeyRound } from "lucide-react";
|
|
3
4
|
import { useState } from "react";
|
|
4
5
|
import { useLink, useNotification, useRegister } from "@refinedev/core";
|
|
5
6
|
import { useSearchParams } from "react-router";
|
|
6
7
|
|
|
7
8
|
import { AuthLayout } from "@/components/auth/auth-layout";
|
|
8
9
|
import { InputPassword } from "@/components/auth/input-password";
|
|
10
|
+
import type {
|
|
11
|
+
Authenticator,
|
|
12
|
+
AuthenticatorSignUpField,
|
|
13
|
+
} from "@/components/auth/types";
|
|
14
|
+
import { usePublicAuthenticators } from "@/components/auth/use-public-authenticators";
|
|
15
|
+
import {
|
|
16
|
+
Alert,
|
|
17
|
+
AlertDescription,
|
|
18
|
+
AlertTitle,
|
|
19
|
+
} from "@/components/ui/alert";
|
|
9
20
|
import { Button } from "@/components/ui/button";
|
|
21
|
+
import { Checkbox } from "@/components/ui/checkbox";
|
|
22
|
+
import {
|
|
23
|
+
Empty,
|
|
24
|
+
EmptyDescription,
|
|
25
|
+
EmptyHeader,
|
|
26
|
+
EmptyMedia,
|
|
27
|
+
EmptyTitle,
|
|
28
|
+
} from "@/components/ui/empty";
|
|
10
29
|
import { Input } from "@/components/ui/input";
|
|
11
30
|
import { Label } from "@/components/ui/label";
|
|
31
|
+
import {
|
|
32
|
+
Select,
|
|
33
|
+
SelectContent,
|
|
34
|
+
SelectItem,
|
|
35
|
+
SelectTrigger,
|
|
36
|
+
SelectValue,
|
|
37
|
+
} from "@/components/ui/select";
|
|
38
|
+
import { Spinner } from "@/components/ui/spinner";
|
|
39
|
+
import { Textarea } from "@/components/ui/textarea";
|
|
40
|
+
import { resolveTranslatableText } from "@/lib/i18n";
|
|
12
41
|
|
|
13
|
-
|
|
14
|
-
|
|
42
|
+
type SignUpFieldValue = string | number | boolean;
|
|
43
|
+
type SignUpValues = Record<string, SignUpFieldValue>;
|
|
44
|
+
|
|
45
|
+
type SignUpVariables = SignUpValues & {
|
|
46
|
+
authenticator: string;
|
|
47
|
+
password: string;
|
|
48
|
+
confirm_password: string;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
function getFieldLabel(field: AuthenticatorSignUpField) {
|
|
52
|
+
return (
|
|
53
|
+
resolveTranslatableText(field.uiSchema?.title, {
|
|
54
|
+
ns: "lm-collections",
|
|
55
|
+
}) || field.field
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function getFieldId(authenticatorName: string, fieldName: string) {
|
|
60
|
+
return `${authenticatorName}-${fieldName}`.replace(/[^a-zA-Z0-9_-]/g, "-");
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function DynamicSignUpField({
|
|
64
|
+
authenticatorName,
|
|
65
|
+
field,
|
|
66
|
+
value,
|
|
67
|
+
onChange,
|
|
68
|
+
}: {
|
|
69
|
+
authenticatorName: string;
|
|
70
|
+
field: AuthenticatorSignUpField;
|
|
71
|
+
value: SignUpFieldValue | undefined;
|
|
72
|
+
onChange: (value: SignUpFieldValue) => void;
|
|
73
|
+
}) {
|
|
74
|
+
const id = getFieldId(authenticatorName, field.field);
|
|
75
|
+
const label = getFieldLabel(field);
|
|
76
|
+
const component = field.uiSchema?.["x-component"];
|
|
77
|
+
const options = field.uiSchema?.enum;
|
|
78
|
+
|
|
79
|
+
if (options?.length) {
|
|
80
|
+
const selectedValue =
|
|
81
|
+
typeof value === "undefined" ? undefined : String(value);
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<div className="space-y-2">
|
|
85
|
+
<Label htmlFor={id}>{label}</Label>
|
|
86
|
+
<Select
|
|
87
|
+
value={selectedValue}
|
|
88
|
+
onValueChange={(nextValue) => {
|
|
89
|
+
if (nextValue === null) return;
|
|
90
|
+
const option = options.find(
|
|
91
|
+
(item) => String(item.value) === nextValue
|
|
92
|
+
);
|
|
93
|
+
onChange(option?.value ?? nextValue);
|
|
94
|
+
}}
|
|
95
|
+
>
|
|
96
|
+
<SelectTrigger id={id} className="w-full" aria-required={field.required}>
|
|
97
|
+
<SelectValue />
|
|
98
|
+
</SelectTrigger>
|
|
99
|
+
<SelectContent>
|
|
100
|
+
{options.map((option) => (
|
|
101
|
+
<SelectItem
|
|
102
|
+
key={`${typeof option.value}:${String(option.value)}`}
|
|
103
|
+
value={String(option.value)}
|
|
104
|
+
>
|
|
105
|
+
{resolveTranslatableText(option.label) || String(option.value)}
|
|
106
|
+
</SelectItem>
|
|
107
|
+
))}
|
|
108
|
+
</SelectContent>
|
|
109
|
+
</Select>
|
|
110
|
+
</div>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (component === "Checkbox") {
|
|
115
|
+
return (
|
|
116
|
+
<div className="flex items-center gap-2">
|
|
117
|
+
<Checkbox
|
|
118
|
+
id={id}
|
|
119
|
+
name={field.field}
|
|
120
|
+
checked={value === true}
|
|
121
|
+
onCheckedChange={(checked) => onChange(checked)}
|
|
122
|
+
aria-required={field.required}
|
|
123
|
+
/>
|
|
124
|
+
<Label htmlFor={id}>{label}</Label>
|
|
125
|
+
</div>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (component === "Input.TextArea" || component === "TextArea") {
|
|
130
|
+
return (
|
|
131
|
+
<div className="space-y-2">
|
|
132
|
+
<Label htmlFor={id}>{label}</Label>
|
|
133
|
+
<Textarea
|
|
134
|
+
id={id}
|
|
135
|
+
name={field.field}
|
|
136
|
+
value={typeof value === "string" ? value : ""}
|
|
137
|
+
onChange={(event) => onChange(event.target.value)}
|
|
138
|
+
required={field.required}
|
|
139
|
+
rows={4}
|
|
140
|
+
/>
|
|
141
|
+
</div>
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return (
|
|
146
|
+
<div className="space-y-2">
|
|
147
|
+
<Label htmlFor={id}>{label}</Label>
|
|
148
|
+
<Input
|
|
149
|
+
id={id}
|
|
150
|
+
name={field.field}
|
|
151
|
+
type={field.field === "email" ? "email" : "text"}
|
|
152
|
+
value={typeof value === "string" ? value : ""}
|
|
153
|
+
onChange={(event) => onChange(event.target.value)}
|
|
154
|
+
autoComplete={
|
|
155
|
+
field.field === "email"
|
|
156
|
+
? "email"
|
|
157
|
+
: field.field === "username"
|
|
158
|
+
? "username"
|
|
159
|
+
: undefined
|
|
160
|
+
}
|
|
161
|
+
required={field.required}
|
|
162
|
+
/>
|
|
163
|
+
</div>
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function BasicSignUpForm({ authenticator }: { authenticator: Authenticator }) {
|
|
168
|
+
const [values, setValues] = useState<SignUpValues>({});
|
|
15
169
|
const [password, setPassword] = useState("");
|
|
16
170
|
const [confirmPassword, setConfirmPassword] = useState("");
|
|
17
171
|
const { open } = useNotification();
|
|
18
172
|
const Link = useLink();
|
|
19
|
-
const
|
|
20
|
-
const
|
|
173
|
+
const { mutate: register, isPending } = useRegister<SignUpVariables>();
|
|
174
|
+
const fields = (authenticator.options?.signupForm ?? []).filter(
|
|
175
|
+
(field) =>
|
|
176
|
+
field?.show &&
|
|
177
|
+
field.field !== "password" &&
|
|
178
|
+
field.field !== "confirm_password"
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
const updateValue = (field: string, value: SignUpFieldValue) => {
|
|
182
|
+
setValues((current) => ({ ...current, [field]: value }));
|
|
183
|
+
};
|
|
21
184
|
|
|
22
185
|
const handleSignUp = (event: React.FormEvent<HTMLFormElement>) => {
|
|
23
186
|
event.preventDefault();
|
|
24
187
|
|
|
188
|
+
const missingField = fields.find(
|
|
189
|
+
(field) => field.required && !values[field.field]
|
|
190
|
+
);
|
|
191
|
+
if (missingField) {
|
|
192
|
+
open?.({
|
|
193
|
+
type: "error",
|
|
194
|
+
message: `Please enter ${getFieldLabel(missingField)}`,
|
|
195
|
+
});
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
|
|
25
199
|
if (password !== confirmPassword) {
|
|
26
200
|
open?.({
|
|
27
201
|
type: "error",
|
|
@@ -32,71 +206,125 @@ export const SignUpForm = () => {
|
|
|
32
206
|
}
|
|
33
207
|
|
|
34
208
|
register({
|
|
35
|
-
|
|
209
|
+
...values,
|
|
36
210
|
password,
|
|
37
|
-
|
|
211
|
+
confirm_password: confirmPassword,
|
|
212
|
+
authenticator: authenticator.name,
|
|
38
213
|
});
|
|
39
214
|
};
|
|
40
215
|
|
|
216
|
+
return (
|
|
217
|
+
<form onSubmit={handleSignUp} className="space-y-5">
|
|
218
|
+
{fields.map((field) => (
|
|
219
|
+
<DynamicSignUpField
|
|
220
|
+
key={field.field}
|
|
221
|
+
authenticatorName={authenticator.name}
|
|
222
|
+
field={field}
|
|
223
|
+
value={values[field.field]}
|
|
224
|
+
onChange={(value) => updateValue(field.field, value)}
|
|
225
|
+
/>
|
|
226
|
+
))}
|
|
227
|
+
|
|
228
|
+
<div className="space-y-2">
|
|
229
|
+
<Label htmlFor={`${authenticator.name}-password`}>Password</Label>
|
|
230
|
+
<InputPassword
|
|
231
|
+
id={`${authenticator.name}-password`}
|
|
232
|
+
value={password}
|
|
233
|
+
onChange={(event) => setPassword(event.target.value)}
|
|
234
|
+
autoComplete="new-password"
|
|
235
|
+
required
|
|
236
|
+
/>
|
|
237
|
+
</div>
|
|
238
|
+
|
|
239
|
+
<div className="space-y-2">
|
|
240
|
+
<Label htmlFor={`${authenticator.name}-confirm-password`}>
|
|
241
|
+
Confirm password
|
|
242
|
+
</Label>
|
|
243
|
+
<InputPassword
|
|
244
|
+
id={`${authenticator.name}-confirm-password`}
|
|
245
|
+
value={confirmPassword}
|
|
246
|
+
onChange={(event) => setConfirmPassword(event.target.value)}
|
|
247
|
+
autoComplete="new-password"
|
|
248
|
+
required
|
|
249
|
+
/>
|
|
250
|
+
</div>
|
|
251
|
+
|
|
252
|
+
<Button type="submit" className="w-full" disabled={isPending}>
|
|
253
|
+
{isPending ? "Creating account…" : "Sign up"}
|
|
254
|
+
</Button>
|
|
255
|
+
|
|
256
|
+
<p className="text-center text-sm text-muted-foreground">
|
|
257
|
+
Have an account?{" "}
|
|
258
|
+
<Link
|
|
259
|
+
to="/login"
|
|
260
|
+
className="font-semibold text-foreground underline underline-offset-4"
|
|
261
|
+
>
|
|
262
|
+
Sign in
|
|
263
|
+
</Link>
|
|
264
|
+
</p>
|
|
265
|
+
</form>
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export const SignUpForm = () => {
|
|
270
|
+
const [searchParams] = useSearchParams();
|
|
271
|
+
const { data: authenticators = [], error, isPending } =
|
|
272
|
+
usePublicAuthenticators();
|
|
273
|
+
const authenticatorName = searchParams.get("name");
|
|
274
|
+
const authenticator = authenticators.find(
|
|
275
|
+
(item) => item.name === authenticatorName
|
|
276
|
+
);
|
|
277
|
+
|
|
41
278
|
return (
|
|
42
279
|
<AuthLayout
|
|
43
280
|
title="Create your account"
|
|
44
281
|
description="Create your NocoBase account."
|
|
45
282
|
>
|
|
46
|
-
|
|
47
|
-
<div className="
|
|
48
|
-
<
|
|
49
|
-
<Input
|
|
50
|
-
id="email"
|
|
51
|
-
type="email"
|
|
52
|
-
value={email}
|
|
53
|
-
onChange={(event) => setEmail(event.target.value)}
|
|
54
|
-
autoComplete="email"
|
|
55
|
-
autoFocus
|
|
56
|
-
required
|
|
57
|
-
/>
|
|
283
|
+
{isPending ? (
|
|
284
|
+
<div className="flex min-h-64 items-center justify-center">
|
|
285
|
+
<Spinner className="size-6 text-muted-foreground" />
|
|
58
286
|
</div>
|
|
59
|
-
|
|
60
|
-
<
|
|
61
|
-
<
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
287
|
+
) : error ? (
|
|
288
|
+
<Alert variant="destructive">
|
|
289
|
+
<AlertCircle />
|
|
290
|
+
<AlertTitle>Unable to load the sign-up method</AlertTitle>
|
|
291
|
+
<AlertDescription>
|
|
292
|
+
{import.meta.env.DEV && error instanceof Error
|
|
293
|
+
? error.message
|
|
294
|
+
: "Please try again or contact your administrator."}
|
|
295
|
+
</AlertDescription>
|
|
296
|
+
</Alert>
|
|
297
|
+
) : !authenticator || authenticator.authType !== "Email/Password" ? (
|
|
298
|
+
<Empty className="min-h-64 border">
|
|
299
|
+
<EmptyHeader>
|
|
300
|
+
<EmptyMedia variant="icon">
|
|
301
|
+
<KeyRound />
|
|
302
|
+
</EmptyMedia>
|
|
303
|
+
<EmptyTitle>No sign-up method available</EmptyTitle>
|
|
304
|
+
<EmptyDescription>
|
|
305
|
+
This sign-up link is invalid or the authentication method does
|
|
306
|
+
not support account registration.
|
|
307
|
+
</EmptyDescription>
|
|
308
|
+
</EmptyHeader>
|
|
309
|
+
</Empty>
|
|
310
|
+
) : authenticator.options?.allowSignUp !== true ? (
|
|
311
|
+
<Empty className="min-h-64 border">
|
|
312
|
+
<EmptyHeader>
|
|
313
|
+
<EmptyMedia variant="icon">
|
|
314
|
+
<KeyRound />
|
|
315
|
+
</EmptyMedia>
|
|
316
|
+
<EmptyTitle>Account registration is disabled</EmptyTitle>
|
|
317
|
+
<EmptyDescription>
|
|
318
|
+
Contact your administrator if you need an account.
|
|
319
|
+
</EmptyDescription>
|
|
320
|
+
</EmptyHeader>
|
|
321
|
+
</Empty>
|
|
322
|
+
) : (
|
|
323
|
+
<BasicSignUpForm
|
|
324
|
+
key={authenticator.name}
|
|
325
|
+
authenticator={authenticator}
|
|
326
|
+
/>
|
|
327
|
+
)}
|
|
100
328
|
</AuthLayout>
|
|
101
329
|
);
|
|
102
330
|
};
|
|
@@ -4,12 +4,34 @@ import type {
|
|
|
4
4
|
ReactNode,
|
|
5
5
|
} from "react";
|
|
6
6
|
|
|
7
|
+
export type AuthenticatorSignUpFieldOption = {
|
|
8
|
+
label?: unknown;
|
|
9
|
+
value: string | number | boolean;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type AuthenticatorSignUpField = {
|
|
13
|
+
field: string;
|
|
14
|
+
required?: boolean;
|
|
15
|
+
show?: boolean;
|
|
16
|
+
uiSchema?: {
|
|
17
|
+
enum?: AuthenticatorSignUpFieldOption[];
|
|
18
|
+
title?: unknown;
|
|
19
|
+
"x-component"?: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type AuthenticatorPublicOptions = Record<string, unknown> & {
|
|
24
|
+
allowSignUp?: boolean;
|
|
25
|
+
enableResetPassword?: boolean;
|
|
26
|
+
signupForm?: AuthenticatorSignUpField[];
|
|
27
|
+
};
|
|
28
|
+
|
|
7
29
|
export type Authenticator = {
|
|
8
30
|
name: string;
|
|
9
31
|
authType: string;
|
|
10
32
|
authTypeTitle?: string;
|
|
11
33
|
title?: string;
|
|
12
|
-
options?:
|
|
34
|
+
options?: AuthenticatorPublicOptions;
|
|
13
35
|
sort?: number;
|
|
14
36
|
};
|
|
15
37
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r}from"./index-MB-jfQld.js";import{A as i}from"./auto-redirect-provider-CfwRvYOI.js";import{i as t}from"./use-wecom-sign-in-C9j8wfCD.js";function n({children:e}){const o=t();return r.jsx(i,{resource:"wecom",action:"checkLogin",enabled:o,query:{isWeComBrowser:o},children:e})}export{n as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./index-MB-jfQld.js";import{A as t}from"./auto-redirect-provider-CfwRvYOI.js";function c({children:r}){return e.jsx(t,{resource:"saml",action:"checkRedirect",children:r})}export{c as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./index-MB-jfQld.js";import{A as t}from"./auto-redirect-provider-CfwRvYOI.js";function c({children:r}){return e.jsx(t,{resource:"oidc",action:"checkRedirect",children:r})}export{c as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{H as t,N as c,as as m,at as o}from"./echarts-runtime-D8kXn6ME.js";function S(e,a,n){a=t(a)&&{coordDimensions:a}||c({encodeDefine:e.getEncode()},a);var r=e.getSource(),s=m(r,a).dimensions,i=new o(s,e);return i.initData(r,n),i}export{S as c};
|