@ebubekirylmaz/link-test 1.2.44 → 1.2.46
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/package.json +13 -6
- package/src/Platform.jsx +14 -15
- package/src/assets/illustrations/avatar-shape.jsx +6 -7
- package/src/assets/illustrations/booking-illustration.jsx +4 -14
- package/src/assets/illustrations/check-in-illustration.jsx +4 -10
- package/src/assets/illustrations/check-out-illustration.jsx +4 -3
- package/src/assets/illustrations/coming-soon-illustration.jsx +4 -17
- package/src/assets/illustrations/forbidden-illustration.jsx +4 -12
- package/src/assets/illustrations/maintenance-illustration.jsx +4 -24
- package/src/assets/illustrations/motivation-illustration.jsx +4 -9
- package/src/assets/illustrations/order-complete-illustration.jsx +4 -12
- package/src/assets/illustrations/page-not-found-illustration.jsx +4 -9
- package/src/assets/illustrations/seo-illustration.jsx +4 -16
- package/src/assets/illustrations/sever-error-illustration.jsx +4 -21
- package/src/assets/illustrations/upgrade-storage-illustration.jsx +4 -20
- package/src/assets/illustrations/upload-illustration.jsx +4 -81
- package/src/components/NucleoidLoginForm/NucleoidLoginForm.jsx +1 -0
- package/src/components/TopNavBar/TopNavBar.jsx +6 -2
- package/src/components/file-thumbnail/file-thumbnail.jsx +5 -6
- package/src/components/nav-section/horizontal/nav-section-horizontal.jsx +5 -6
- package/src/components/settings/drawer/layout-options.jsx +5 -4
- package/src/components/settings/drawer/presets-options.jsx +6 -5
- package/src/components/settings/drawer/settings-drawer.jsx +7 -4
- package/src/components/settings/drawer/stretch-options.jsx +5 -5
- package/src/config/schemas.js +1 -0
- package/src/context/Context.js +98 -0
- package/src/context/reducer.js +590 -10
- package/src/hooks/index.js +2 -1
- package/src/hooks/use-beta.js +8 -0
- package/src/layouts/DashboardLayout/header.jsx +5 -4
- package/src/layouts/DashboardLayout/nav-mini.jsx +5 -7
- package/src/layouts/DashboardLayout/nav-vertical.jsx +11 -11
- package/src/layouts/FullScreenLayout/FullScreenLayout.jsx +5 -1
- package/src/layouts/FullScreenLayout/nav-vertical.jsx +11 -11
- package/src/layouts/MainLayout/footer.jsx +7 -7
- package/src/layouts/MainLayout/header.jsx +3 -2
- package/src/layouts/MainLayout/nav/desktop/nav-list.jsx +8 -8
- package/src/layouts/MainLayout/nav/mobile/index.jsx +7 -6
- package/src/layouts/auth/classic.jsx +6 -6
- package/src/layouts/auth/modern.jsx +7 -6
- package/src/layouts/common/ProjectBar/index.jsx +13 -11
- package/src/layouts/common/account-popover.jsx +1 -2
- package/src/layouts/common/header-sim.jsx +3 -2
- package/src/layouts/common/header-simple.jsx +6 -3
- package/src/layouts/common/notifications-popover/index.jsx +18 -13
- package/src/layouts/common/notifications-popover/notification-item.jsx +28 -16
- package/src/lib/APIDialogAction/APIDialogAction.jsx +109 -0
- package/src/lib/APIDialogAction/index.js +1 -0
- package/src/lib/APIDialogAction/styles.js +6 -0
- package/src/lib/APIParams/APIParams.jsx +57 -0
- package/src/lib/APIParams/index.js +1 -0
- package/src/lib/APIPath/APIPath.jsx +82 -0
- package/src/lib/APIPath/index.js +1 -0
- package/src/lib/APIPath/styles.js +19 -0
- package/src/lib/APITree/APITree.jsx +411 -0
- package/src/lib/APITree/Arrow.jsx +21 -0
- package/src/lib/APITree/DeleteMethodDialog.jsx +41 -0
- package/src/lib/APITree/index.js +1 -0
- package/src/lib/APITree/styles.js +19 -0
- package/src/lib/APITypes/APITypes.jsx +141 -0
- package/src/lib/APITypes/TypeEditor.jsx +46 -0
- package/src/lib/APITypes/TypeList.jsx +180 -0
- package/src/lib/APITypes/index.js +1 -0
- package/src/lib/AddItemWizard/AddItemWizard.jsx +21 -10
- package/src/lib/BlankTreeMessage/BlankTreeMessage.jsx +39 -0
- package/src/lib/BlankTreeMessage/index.js +1 -0
- package/src/lib/CustomBreadcrumbs/CustomBreadcrumbs.jsx +3 -2
- package/src/lib/DialogTootip/DialogTooltip.jsx +67 -0
- package/src/lib/DialogTootip/index.js +1 -0
- package/src/lib/DialogTootip/styles.js +9 -0
- package/src/lib/Flow/connectors/DynamicConnector.jsx +179 -107
- package/src/lib/Flow/core/Flow.jsx +2 -0
- package/src/lib/Flow/core/FlowNode.jsx +2 -0
- package/src/lib/Flow/core/FlowViewport.jsx +41 -9
- package/src/lib/Flow/hooks/useNodeStyle.js +14 -0
- package/src/lib/Flow/layouts/CardLayout.jsx +4 -3
- package/src/lib/Flow/nodes/DefaultCard.jsx +6 -8
- package/src/lib/Flow/nodes/FlowNodeView.jsx +105 -21
- package/src/lib/Flow/styles.js +4 -0
- package/src/lib/IconSelector/IconSelector.jsx +5 -1
- package/src/lib/ItemSummary/ItemSummary.jsx +11 -6
- package/src/lib/ItemSummary/ItemsSummary.jsx +38 -26
- package/src/lib/NewApiBody/NewAPIBody.jsx +97 -0
- package/src/lib/NewApiBody/ParamView.jsx +38 -0
- package/src/lib/NucDialog/NucDialog.jsx +108 -0
- package/src/lib/NucDialog/index.js +1 -0
- package/src/lib/ParamTable/ParamTable.jsx +133 -0
- package/src/lib/ParamTable/TypeMenu.jsx +102 -0
- package/src/lib/ParamTable/defaults.js +47 -0
- package/src/lib/ParamTable/index.js +1 -0
- package/src/lib/ParamTable/styles.js +12 -0
- package/src/lib/ResourceMenu/AlertMassage.jsx +28 -0
- package/src/lib/ResourceMenu/DeleteResourceDialog.jsx +60 -0
- package/src/lib/ResourceMenu/ResourceMenu.jsx +158 -0
- package/src/lib/ResourceMenu/index.js +1 -0
- package/src/lib/ResourceMenu/styles.js +5 -0
- package/src/lib/Schema/Schema.jsx +204 -0
- package/src/lib/Schema/index.js +1 -0
- package/src/lib/SchemaEditor/SchemaEditor.jsx +258 -0
- package/src/lib/SchemaEditor/SchemaEditor.test.js +193 -0
- package/src/lib/SchemaEditor/SchemaPropertyEditor.jsx +135 -0
- package/src/lib/SchemaEditor/SchemaUtils.js +152 -0
- package/src/lib/SchemaEditor/index.js +1 -0
- package/src/lib/SparkleInput/SparkleInput.jsx +31 -28
- package/src/lib/TableSelectedAction/TableSelectedAction.jsx +7 -8
- package/src/lib/ToggleableMenu/ToggleableMenu.jsx +35 -0
- package/src/lib/ToggleableMenu/index.js +1 -0
- package/src/lib/index.js +14 -0
- package/src/pages/Callback.jsx +6 -8
- package/src/pages/ConfigError.jsx +3 -1
- package/src/pages/LoginPage.jsx +3 -12
- package/src/stories/APITree.stories.jsx +429 -0
- package/src/stories/FlowChart.stories.jsx +1 -1
- package/src/templates/ActionTemplate.js +24 -0
- package/src/theme/overrides/default-props.jsx +17 -11
- package/src/widgets/Login/CognitoLogin.jsx +165 -173
- package/src/widgets/Login/DemoLogin.jsx +43 -38
- package/src/widgets/Login/amplifyAuth.js +6 -6
- package/src/widgets/Login/amplifyConfig.js +3 -0
- package/src/widgets/LoginForm/LoginForm.jsx +8 -3
- package/src/widgets/SettingsDialog.jsx +206 -16
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import config from "../../config/config";
|
|
2
|
+
import { publish } from "@nucleoidai/react-event";
|
|
3
|
+
import { storage } from "@nucleoidjs/webstorage";
|
|
4
|
+
import { useNavigate } from "react-router-dom";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
|
|
1
7
|
import {
|
|
2
8
|
Box,
|
|
3
9
|
Button,
|
|
4
|
-
Card,
|
|
5
10
|
IconButton,
|
|
6
11
|
InputAdornment,
|
|
7
12
|
Stack,
|
|
@@ -10,6 +15,7 @@ import {
|
|
|
10
15
|
alpha,
|
|
11
16
|
} from "@mui/material";
|
|
12
17
|
import {
|
|
18
|
+
CheckOutlined,
|
|
13
19
|
EmailOutlined,
|
|
14
20
|
LockOutlined,
|
|
15
21
|
MarkEmailReadOutlined,
|
|
@@ -18,12 +24,6 @@ import {
|
|
|
18
24
|
} from "@mui/icons-material";
|
|
19
25
|
import { confirmSignup, getTokens, login, signup } from "./amplifyAuth";
|
|
20
26
|
|
|
21
|
-
import config from "../../config/config";
|
|
22
|
-
import { publish } from "@nucleoidai/react-event";
|
|
23
|
-
import { storage } from "@nucleoidjs/webstorage";
|
|
24
|
-
import { useNavigate } from "react-router-dom";
|
|
25
|
-
import { useState } from "react";
|
|
26
|
-
|
|
27
27
|
const inputSx = {
|
|
28
28
|
"& .MuiOutlinedInput-root": {
|
|
29
29
|
fontSize: "1rem",
|
|
@@ -38,14 +38,6 @@ const primaryButtonSx = {
|
|
|
38
38
|
fontWeight: 600,
|
|
39
39
|
textTransform: "none",
|
|
40
40
|
borderRadius: 1.5,
|
|
41
|
-
boxShadow: (theme) =>
|
|
42
|
-
`0 8px 16px ${alpha(theme.palette.primary.main, 0.24)}`,
|
|
43
|
-
transition: "all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
|
|
44
|
-
"&:hover": {
|
|
45
|
-
transform: "translateY(-2px)",
|
|
46
|
-
boxShadow: (theme) =>
|
|
47
|
-
`0 12px 24px ${alpha(theme.palette.primary.main, 0.32)}`,
|
|
48
|
-
},
|
|
49
41
|
"&:active": { transform: "translateY(0px)" },
|
|
50
42
|
};
|
|
51
43
|
|
|
@@ -54,12 +46,14 @@ export default function CognitoLogin() {
|
|
|
54
46
|
|
|
55
47
|
const [email, setEmail] = useState("");
|
|
56
48
|
const [password, setPassword] = useState("");
|
|
49
|
+
const [confirmPassword, setConfirmPassword] = useState("");
|
|
57
50
|
const [code, setCode] = useState("");
|
|
58
51
|
const [showPassword, setShowPassword] = useState(false);
|
|
52
|
+
const [showConfirmPassword, setShowConfirmPassword] = useState(false);
|
|
59
53
|
|
|
60
54
|
const navigate = useNavigate();
|
|
61
55
|
|
|
62
|
-
const { appId } = config();
|
|
56
|
+
const { appId, credentials } = config();
|
|
63
57
|
|
|
64
58
|
const handleLogin = async () => {
|
|
65
59
|
try {
|
|
@@ -69,7 +63,9 @@ export default function CognitoLogin() {
|
|
|
69
63
|
if (!tokens?.accessToken)
|
|
70
64
|
throw new Error("No Cognito access token received");
|
|
71
65
|
|
|
72
|
-
const
|
|
66
|
+
const requestUrl = credentials.requestUrl || "/api/oauth";
|
|
67
|
+
|
|
68
|
+
const res = await fetch(requestUrl, {
|
|
73
69
|
method: "POST",
|
|
74
70
|
headers: { "Content-Type": "application/json" },
|
|
75
71
|
body: JSON.stringify({
|
|
@@ -101,7 +97,7 @@ export default function CognitoLogin() {
|
|
|
101
97
|
|
|
102
98
|
const handleSignup = async () => {
|
|
103
99
|
try {
|
|
104
|
-
await signup(email, password
|
|
100
|
+
await signup(email, password);
|
|
105
101
|
publish("GLOBAL_MESSAGE_POSTED", {
|
|
106
102
|
status: true,
|
|
107
103
|
message:
|
|
@@ -162,91 +158,67 @@ export default function CognitoLogin() {
|
|
|
162
158
|
);
|
|
163
159
|
|
|
164
160
|
return (
|
|
165
|
-
<
|
|
166
|
-
sx={{
|
|
167
|
-
minHeight: "100vh",
|
|
168
|
-
display: "flex",
|
|
169
|
-
alignItems: "center",
|
|
170
|
-
justifyContent: "center",
|
|
171
|
-
px: 2,
|
|
172
|
-
background: (theme) =>
|
|
173
|
-
`linear-gradient(135deg, ${alpha(theme.palette.primary.lighter, 0.4)} 0%, ${alpha(theme.palette.background.default, 1)} 60%)`,
|
|
174
|
-
}}
|
|
175
|
-
>
|
|
176
|
-
<Card
|
|
177
|
-
sx={{
|
|
178
|
-
width: "100%",
|
|
179
|
-
maxWidth: 440,
|
|
180
|
-
py: { xs: 5, md: 7 },
|
|
181
|
-
px: { xs: 3, md: 5 },
|
|
182
|
-
borderRadius: 3,
|
|
183
|
-
boxShadow: (theme) =>
|
|
184
|
-
`0 0 2px ${alpha(theme.palette.grey[500], 0.16)}, 0 24px 48px -4px ${alpha(theme.palette.grey[500], 0.16)}`,
|
|
185
|
-
}}
|
|
186
|
-
>
|
|
161
|
+
<Stack spacing={3} sx={{ mb: 2 }}>
|
|
162
|
+
<Box sx={{ textAlign: "center" }}>
|
|
187
163
|
<Box
|
|
188
164
|
sx={{
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
165
|
+
width: 52,
|
|
166
|
+
height: 52,
|
|
167
|
+
borderRadius: 2,
|
|
168
|
+
display: "inline-flex",
|
|
192
169
|
alignItems: "center",
|
|
193
|
-
|
|
170
|
+
justifyContent: "center",
|
|
171
|
+
mb: 2,
|
|
172
|
+
bgcolor: (theme) => alpha(theme.palette.primary.main, 0.1),
|
|
173
|
+
color: "primary.main",
|
|
194
174
|
}}
|
|
195
175
|
>
|
|
196
|
-
|
|
197
|
-
sx={{
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
display: "flex",
|
|
202
|
-
alignItems: "center",
|
|
203
|
-
justifyContent: "center",
|
|
204
|
-
mb: 2.5,
|
|
205
|
-
bgcolor: (theme) => alpha(theme.palette.primary.main, 0.1),
|
|
206
|
-
color: "primary.main",
|
|
207
|
-
}}
|
|
208
|
-
>
|
|
209
|
-
{mode === "confirm" ? (
|
|
210
|
-
<MarkEmailReadOutlined sx={{ fontSize: 28 }} />
|
|
211
|
-
) : (
|
|
212
|
-
<LockOutlined sx={{ fontSize: 28 }} />
|
|
213
|
-
)}
|
|
214
|
-
</Box>
|
|
215
|
-
|
|
216
|
-
<Typography variant="h4" fontWeight={700} gutterBottom>
|
|
217
|
-
{titles[mode].heading}
|
|
218
|
-
</Typography>
|
|
219
|
-
<Typography variant="body2" color="text.secondary">
|
|
220
|
-
{titles[mode].sub}
|
|
221
|
-
</Typography>
|
|
176
|
+
{mode === "confirm" ? (
|
|
177
|
+
<MarkEmailReadOutlined sx={{ fontSize: 26 }} />
|
|
178
|
+
) : (
|
|
179
|
+
<LockOutlined sx={{ fontSize: 26 }} />
|
|
180
|
+
)}
|
|
222
181
|
</Box>
|
|
223
182
|
|
|
224
|
-
<
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
183
|
+
<Typography variant="h4" gutterBottom sx={{
|
|
184
|
+
fontWeight: 700
|
|
185
|
+
}}>
|
|
186
|
+
{titles[mode].heading}
|
|
187
|
+
</Typography>
|
|
188
|
+
<Typography variant="body2" sx={{
|
|
189
|
+
color: "text.secondary"
|
|
190
|
+
}}>
|
|
191
|
+
{titles[mode].sub}
|
|
192
|
+
</Typography>
|
|
193
|
+
</Box>
|
|
194
|
+
<Stack spacing={2}>
|
|
195
|
+
<TextField
|
|
196
|
+
label="Email"
|
|
197
|
+
value={email}
|
|
198
|
+
onChange={(e) => setEmail(e.target.value)}
|
|
199
|
+
fullWidth
|
|
200
|
+
sx={inputSx}
|
|
201
|
+
slotProps={{
|
|
202
|
+
input: {
|
|
231
203
|
startAdornment: (
|
|
232
204
|
<InputAdornment position="start">
|
|
233
|
-
<EmailOutlined
|
|
234
|
-
sx={{ color: "text.secondary", fontSize: 22 }}
|
|
235
|
-
/>
|
|
205
|
+
<EmailOutlined sx={{ color: "text.secondary", fontSize: 22 }} />
|
|
236
206
|
</InputAdornment>
|
|
237
207
|
),
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
|
|
208
|
+
}
|
|
209
|
+
}}
|
|
210
|
+
/>
|
|
241
211
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
212
|
+
{mode !== "confirm" && (
|
|
213
|
+
<TextField
|
|
214
|
+
type={showPassword ? "text" : "password"}
|
|
215
|
+
label="Password"
|
|
216
|
+
value={password}
|
|
217
|
+
onChange={(e) => setPassword(e.target.value)}
|
|
218
|
+
fullWidth
|
|
219
|
+
sx={inputSx}
|
|
220
|
+
slotProps={{
|
|
221
|
+
input: {
|
|
250
222
|
startAdornment: (
|
|
251
223
|
<InputAdornment position="start">
|
|
252
224
|
<LockOutlined
|
|
@@ -255,19 +227,21 @@ export default function CognitoLogin() {
|
|
|
255
227
|
</InputAdornment>
|
|
256
228
|
),
|
|
257
229
|
endAdornment: passwordAdornment,
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
230
|
+
}
|
|
231
|
+
}}
|
|
232
|
+
/>
|
|
233
|
+
)}
|
|
262
234
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
235
|
+
{mode === "signup" && (
|
|
236
|
+
<TextField
|
|
237
|
+
type={showConfirmPassword ? "text" : "password"}
|
|
238
|
+
label="Confirm Password"
|
|
239
|
+
value={confirmPassword}
|
|
240
|
+
onChange={(e) => setConfirmPassword(e.target.value)}
|
|
241
|
+
fullWidth
|
|
242
|
+
sx={inputSx}
|
|
243
|
+
slotProps={{
|
|
244
|
+
input: {
|
|
271
245
|
startAdornment: (
|
|
272
246
|
<InputAdornment position="start">
|
|
273
247
|
<LockOutlined
|
|
@@ -275,77 +249,95 @@ export default function CognitoLogin() {
|
|
|
275
249
|
/>
|
|
276
250
|
</InputAdornment>
|
|
277
251
|
),
|
|
278
|
-
endAdornment:
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
{mode === "login" && (
|
|
295
|
-
<Stack spacing={1.5} pt={0.5}>
|
|
296
|
-
<Button
|
|
297
|
-
variant="contained"
|
|
298
|
-
onClick={handleLogin}
|
|
299
|
-
size="large"
|
|
300
|
-
fullWidth
|
|
301
|
-
sx={primaryButtonSx}
|
|
302
|
-
>
|
|
303
|
-
Sign in
|
|
304
|
-
</Button>
|
|
305
|
-
<Button
|
|
306
|
-
onClick={() => setMode("signup")}
|
|
307
|
-
fullWidth
|
|
308
|
-
sx={{ textTransform: "none", fontWeight: 500 }}
|
|
309
|
-
>
|
|
310
|
-
Create an account
|
|
311
|
-
</Button>
|
|
312
|
-
</Stack>
|
|
313
|
-
)}
|
|
314
|
-
|
|
315
|
-
{mode === "signup" && (
|
|
316
|
-
<Stack spacing={1.5} pt={0.5}>
|
|
317
|
-
<Button
|
|
318
|
-
variant="contained"
|
|
319
|
-
onClick={handleSignup}
|
|
320
|
-
size="large"
|
|
321
|
-
fullWidth
|
|
322
|
-
sx={primaryButtonSx}
|
|
323
|
-
>
|
|
324
|
-
Sign Up
|
|
325
|
-
</Button>
|
|
326
|
-
<Button
|
|
327
|
-
onClick={() => setMode("login")}
|
|
328
|
-
fullWidth
|
|
329
|
-
sx={{ textTransform: "none", fontWeight: 500 }}
|
|
330
|
-
>
|
|
331
|
-
Back to login
|
|
332
|
-
</Button>
|
|
333
|
-
</Stack>
|
|
334
|
-
)}
|
|
252
|
+
endAdornment: (
|
|
253
|
+
<InputAdornment position="end">
|
|
254
|
+
<IconButton
|
|
255
|
+
onClick={() => setShowConfirmPassword(!showConfirmPassword)}
|
|
256
|
+
edge="end"
|
|
257
|
+
size="small"
|
|
258
|
+
tabIndex={-1}
|
|
259
|
+
>
|
|
260
|
+
{showConfirmPassword ? <VisibilityOff /> : <Visibility />}
|
|
261
|
+
</IconButton>
|
|
262
|
+
</InputAdornment>
|
|
263
|
+
),
|
|
264
|
+
}
|
|
265
|
+
}}
|
|
266
|
+
/>
|
|
267
|
+
)}
|
|
335
268
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
269
|
+
{mode === "confirm" && (
|
|
270
|
+
<TextField
|
|
271
|
+
label="Confirmation Code"
|
|
272
|
+
value={code}
|
|
273
|
+
onChange={(e) => setCode(e.target.value)}
|
|
274
|
+
fullWidth
|
|
275
|
+
sx={inputSx}
|
|
276
|
+
slotProps={{
|
|
277
|
+
input: {
|
|
278
|
+
startAdornment: (
|
|
279
|
+
<InputAdornment position="start">
|
|
280
|
+
<CheckOutlined
|
|
281
|
+
sx={{ color: "text.secondary", fontSize: 22 }}
|
|
282
|
+
/>
|
|
283
|
+
</InputAdornment>
|
|
284
|
+
),
|
|
285
|
+
}
|
|
286
|
+
}}
|
|
287
|
+
/>
|
|
288
|
+
)}
|
|
289
|
+
</Stack>
|
|
290
|
+
{mode === "login" && (
|
|
291
|
+
<Stack spacing={1.5}>
|
|
292
|
+
<Button
|
|
293
|
+
variant="contained"
|
|
294
|
+
onClick={handleLogin}
|
|
295
|
+
size="large"
|
|
296
|
+
fullWidth
|
|
297
|
+
sx={primaryButtonSx}
|
|
298
|
+
>
|
|
299
|
+
Sign in
|
|
300
|
+
</Button>
|
|
301
|
+
<Button
|
|
302
|
+
onClick={() => setMode("signup")}
|
|
303
|
+
fullWidth
|
|
304
|
+
sx={{ textTransform: "none", fontWeight: 500 }}
|
|
305
|
+
>
|
|
306
|
+
Create an account
|
|
307
|
+
</Button>
|
|
308
|
+
</Stack>
|
|
309
|
+
)}
|
|
310
|
+
{mode === "signup" && (
|
|
311
|
+
<Stack spacing={1.5}>
|
|
312
|
+
<Button
|
|
313
|
+
variant="contained"
|
|
314
|
+
onClick={handleSignup}
|
|
315
|
+
size="large"
|
|
316
|
+
fullWidth
|
|
317
|
+
sx={primaryButtonSx}
|
|
318
|
+
>
|
|
319
|
+
Sign Up
|
|
320
|
+
</Button>
|
|
321
|
+
<Button
|
|
322
|
+
onClick={() => setMode("login")}
|
|
323
|
+
fullWidth
|
|
324
|
+
sx={{ textTransform: "none", fontWeight: 500 }}
|
|
325
|
+
>
|
|
326
|
+
Back to login
|
|
327
|
+
</Button>
|
|
347
328
|
</Stack>
|
|
348
|
-
|
|
349
|
-
|
|
329
|
+
)}
|
|
330
|
+
{mode === "confirm" && (
|
|
331
|
+
<Button
|
|
332
|
+
variant="contained"
|
|
333
|
+
onClick={handleConfirm}
|
|
334
|
+
size="large"
|
|
335
|
+
fullWidth
|
|
336
|
+
sx={primaryButtonSx}
|
|
337
|
+
>
|
|
338
|
+
Confirm
|
|
339
|
+
</Button>
|
|
340
|
+
)}
|
|
341
|
+
</Stack>
|
|
350
342
|
);
|
|
351
343
|
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import config from "../../config/config";
|
|
2
|
+
import { storage } from "@nucleoidjs/webstorage";
|
|
3
|
+
import { useNavigate } from "react-router-dom";
|
|
4
|
+
|
|
1
5
|
import {
|
|
2
6
|
Box,
|
|
3
7
|
Button,
|
|
@@ -16,20 +20,18 @@ import {
|
|
|
16
20
|
} from "@mui/icons-material";
|
|
17
21
|
import React, { useState } from "react";
|
|
18
22
|
|
|
19
|
-
import config from "../../config/config";
|
|
20
|
-
import { storage } from "@nucleoidjs/webstorage";
|
|
21
|
-
import { useNavigate } from "react-router-dom";
|
|
22
|
-
|
|
23
23
|
export default function DemoLogin() {
|
|
24
24
|
const [username, setUsername] = useState("");
|
|
25
25
|
const [password, setPassword] = useState("");
|
|
26
26
|
const [showPassword, setShowPassword] = useState(false);
|
|
27
27
|
const navigate = useNavigate();
|
|
28
28
|
|
|
29
|
-
const { appId } = config();
|
|
29
|
+
const { appId, credentials } = config();
|
|
30
30
|
|
|
31
31
|
async function handleLogin() {
|
|
32
|
-
const
|
|
32
|
+
const requestUrl = credentials.requestUrl || "/api/oauth";
|
|
33
|
+
|
|
34
|
+
const res = await fetch(requestUrl, {
|
|
33
35
|
method: "POST",
|
|
34
36
|
headers: { "Content-Type": "application/json" },
|
|
35
37
|
body: JSON.stringify({
|
|
@@ -53,20 +55,13 @@ export default function DemoLogin() {
|
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
return (
|
|
56
|
-
<Stack spacing={2.5}>
|
|
58
|
+
<Stack spacing={2.5} sx={{ mb: 2 }}>
|
|
57
59
|
<Stack spacing={2}>
|
|
58
60
|
<TextField
|
|
59
61
|
label="Username"
|
|
60
62
|
value={username}
|
|
61
63
|
onChange={(e) => setUsername(e.target.value)}
|
|
62
64
|
fullWidth
|
|
63
|
-
InputProps={{
|
|
64
|
-
startAdornment: (
|
|
65
|
-
<InputAdornment position="start">
|
|
66
|
-
<PersonOutline sx={{ color: "text.secondary", fontSize: 22 }} />
|
|
67
|
-
</InputAdornment>
|
|
68
|
-
),
|
|
69
|
-
}}
|
|
70
65
|
sx={{
|
|
71
66
|
"& .MuiOutlinedInput-root": {
|
|
72
67
|
fontSize: "1rem",
|
|
@@ -78,6 +73,15 @@ export default function DemoLogin() {
|
|
|
78
73
|
},
|
|
79
74
|
},
|
|
80
75
|
}}
|
|
76
|
+
slotProps={{
|
|
77
|
+
input: {
|
|
78
|
+
startAdornment: (
|
|
79
|
+
<InputAdornment position="start">
|
|
80
|
+
<PersonOutline sx={{ color: "text.secondary", fontSize: 22 }} />
|
|
81
|
+
</InputAdornment>
|
|
82
|
+
),
|
|
83
|
+
}
|
|
84
|
+
}}
|
|
81
85
|
/>
|
|
82
86
|
|
|
83
87
|
<TextField
|
|
@@ -86,25 +90,6 @@ export default function DemoLogin() {
|
|
|
86
90
|
value={password}
|
|
87
91
|
onChange={(e) => setPassword(e.target.value)}
|
|
88
92
|
fullWidth
|
|
89
|
-
InputProps={{
|
|
90
|
-
startAdornment: (
|
|
91
|
-
<InputAdornment position="start">
|
|
92
|
-
<LockOutlined sx={{ color: "text.secondary", fontSize: 22 }} />
|
|
93
|
-
</InputAdornment>
|
|
94
|
-
),
|
|
95
|
-
endAdornment: (
|
|
96
|
-
<InputAdornment position="end">
|
|
97
|
-
<IconButton
|
|
98
|
-
onClick={() => setShowPassword(!showPassword)}
|
|
99
|
-
edge="end"
|
|
100
|
-
size="small"
|
|
101
|
-
tabIndex={-1}
|
|
102
|
-
>
|
|
103
|
-
{showPassword ? <VisibilityOff /> : <Visibility />}
|
|
104
|
-
</IconButton>
|
|
105
|
-
</InputAdornment>
|
|
106
|
-
),
|
|
107
|
-
}}
|
|
108
93
|
sx={{
|
|
109
94
|
"& .MuiOutlinedInput-root": {
|
|
110
95
|
fontSize: "1rem",
|
|
@@ -121,9 +106,29 @@ export default function DemoLogin() {
|
|
|
121
106
|
handleLogin();
|
|
122
107
|
}
|
|
123
108
|
}}
|
|
109
|
+
slotProps={{
|
|
110
|
+
input: {
|
|
111
|
+
startAdornment: (
|
|
112
|
+
<InputAdornment position="start">
|
|
113
|
+
<LockOutlined sx={{ color: "text.secondary", fontSize: 22 }} />
|
|
114
|
+
</InputAdornment>
|
|
115
|
+
),
|
|
116
|
+
endAdornment: (
|
|
117
|
+
<InputAdornment position="end">
|
|
118
|
+
<IconButton
|
|
119
|
+
onClick={() => setShowPassword(!showPassword)}
|
|
120
|
+
edge="end"
|
|
121
|
+
size="small"
|
|
122
|
+
tabIndex={-1}
|
|
123
|
+
>
|
|
124
|
+
{showPassword ? <VisibilityOff /> : <Visibility />}
|
|
125
|
+
</IconButton>
|
|
126
|
+
</InputAdornment>
|
|
127
|
+
),
|
|
128
|
+
}
|
|
129
|
+
}}
|
|
124
130
|
/>
|
|
125
131
|
</Stack>
|
|
126
|
-
|
|
127
132
|
<Button
|
|
128
133
|
variant="contained"
|
|
129
134
|
onClick={handleLogin}
|
|
@@ -151,7 +156,6 @@ export default function DemoLogin() {
|
|
|
151
156
|
>
|
|
152
157
|
Sign in
|
|
153
158
|
</Button>
|
|
154
|
-
|
|
155
159
|
<Box
|
|
156
160
|
sx={{
|
|
157
161
|
mt: 1,
|
|
@@ -165,9 +169,10 @@ export default function DemoLogin() {
|
|
|
165
169
|
>
|
|
166
170
|
<Typography
|
|
167
171
|
variant="caption"
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
172
|
+
sx={{
|
|
173
|
+
color: "text.secondary",
|
|
174
|
+
fontSize: "0.8125rem"
|
|
175
|
+
}}>
|
|
171
176
|
Demo credentials:{" "}
|
|
172
177
|
<Box component="strong" sx={{ color: "text.primary" }}>
|
|
173
178
|
admin / admin
|
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
signUp,
|
|
7
7
|
} from "aws-amplify/auth";
|
|
8
8
|
|
|
9
|
-
export async function login(
|
|
10
|
-
return signIn({ username, password });
|
|
9
|
+
export async function login(email, password) {
|
|
10
|
+
return signIn({ username: email, password });
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export async function signup(
|
|
13
|
+
export async function signup(email, password) {
|
|
14
14
|
return signUp({
|
|
15
|
-
username,
|
|
15
|
+
username: email,
|
|
16
16
|
password,
|
|
17
17
|
options: {
|
|
18
18
|
userAttributes: {
|
|
@@ -22,9 +22,9 @@ export async function signup(username, password, email) {
|
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export async function confirmSignup(
|
|
25
|
+
export async function confirmSignup(email, code) {
|
|
26
26
|
return confirmSignUp({
|
|
27
|
-
username,
|
|
27
|
+
username: email,
|
|
28
28
|
confirmationCode: code,
|
|
29
29
|
});
|
|
30
30
|
}
|
|
@@ -18,12 +18,17 @@ const handleOAuthLogin = (
|
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
function LoginForm() {
|
|
21
|
-
const { name, project } = config();
|
|
21
|
+
const { name, project, credentials } = config();
|
|
22
22
|
|
|
23
23
|
const [email, setEmail] = useState("");
|
|
24
24
|
const [password, setPassword] = useState("");
|
|
25
25
|
|
|
26
|
-
const
|
|
26
|
+
const providerCheck =
|
|
27
|
+
credentials?.provider === "COGNITO" || credentials?.provider === "DEMO";
|
|
28
|
+
|
|
29
|
+
const hasContent = !providerCheck || !!project.nucleoid;
|
|
30
|
+
|
|
31
|
+
const renderHead = hasContent ? (
|
|
27
32
|
<Stack spacing={2} sx={{ mb: 5 }}>
|
|
28
33
|
<Typography variant="h4">Sign in to {name}</Typography>
|
|
29
34
|
{project.nucleoid && (
|
|
@@ -34,7 +39,7 @@ function LoginForm() {
|
|
|
34
39
|
</Stack>
|
|
35
40
|
)}
|
|
36
41
|
</Stack>
|
|
37
|
-
);
|
|
42
|
+
) : null;
|
|
38
43
|
|
|
39
44
|
const renderForm = (
|
|
40
45
|
<>
|