@ebubekirylmaz/link-test 1.1.1 → 1.1.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/package.json
CHANGED
package/src/config/schemas.js
CHANGED
|
@@ -12,9 +12,9 @@ export const ConfigSchema = Joi.object({
|
|
|
12
12
|
}).optional(),
|
|
13
13
|
credentials: Joi.object({
|
|
14
14
|
provider: Joi.string().valid("DEMO", "COGNITO").required(),
|
|
15
|
-
region: Joi.string().
|
|
16
|
-
userPoolId: Joi.string().
|
|
17
|
-
clientId: Joi.string().
|
|
15
|
+
region: Joi.string().optional(),
|
|
16
|
+
userPoolId: Joi.string().optional(),
|
|
17
|
+
clientId: Joi.string().optional(),
|
|
18
18
|
}).optional(),
|
|
19
19
|
project: Joi.object({
|
|
20
20
|
nucleoid: Joi.object().optional(),
|
package/src/pages/LoginPage.jsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import CognitoLogin from "../widgets/Login/CognitoLogin";
|
|
2
|
+
import DemoLogin from "../widgets/Login/DemoLogin";
|
|
2
3
|
import LoginForm from "../widgets/LoginForm/LoginForm";
|
|
3
4
|
import Page from "../layouts/Page";
|
|
4
5
|
import React from "react";
|
|
@@ -33,6 +34,14 @@ function LoginPage() {
|
|
|
33
34
|
return <CognitoLogin />;
|
|
34
35
|
}
|
|
35
36
|
|
|
37
|
+
if (credentials?.provider === "DEMO") {
|
|
38
|
+
return (
|
|
39
|
+
<Page title={`Sign in to ${name}`}>
|
|
40
|
+
<DemoLogin />
|
|
41
|
+
</Page>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
36
45
|
return (
|
|
37
46
|
<Page title={`Sign in to ${name}`}>
|
|
38
47
|
<LoginForm icon={template.login.icon} name={name} formColor={formColor} />
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { storage } from "@nucleoidjs/webstorage";
|
|
2
|
+
import { useNavigate } from "react-router-dom";
|
|
3
|
+
|
|
4
|
+
import { Button, Stack, TextField, Typography } from "@mui/material";
|
|
5
|
+
import React, { useState } from "react";
|
|
6
|
+
|
|
7
|
+
export default function DemoLogin() {
|
|
8
|
+
const [username, setUsername] = useState("");
|
|
9
|
+
const [password, setPassword] = useState("");
|
|
10
|
+
const navigate = useNavigate();
|
|
11
|
+
|
|
12
|
+
function handleLogin() {
|
|
13
|
+
if (username === "admin" && password === "admin") {
|
|
14
|
+
storage.set("link", "accessToken", "demo-access-token");
|
|
15
|
+
storage.set("link", "refreshToken", "demo-refresh-token");
|
|
16
|
+
navigate("/");
|
|
17
|
+
} else {
|
|
18
|
+
alert("Demo credentials are: admin / admin");
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Stack spacing={2} maxWidth={400} mx="auto">
|
|
24
|
+
<Typography variant="h5">Demo Login</Typography>
|
|
25
|
+
<TextField
|
|
26
|
+
label="Username"
|
|
27
|
+
value={username}
|
|
28
|
+
onChange={(e) => setUsername(e.target.value)}
|
|
29
|
+
/>
|
|
30
|
+
<TextField
|
|
31
|
+
label="Password"
|
|
32
|
+
type="password"
|
|
33
|
+
value={password}
|
|
34
|
+
onChange={(e) => setPassword(e.target.value)}
|
|
35
|
+
/>
|
|
36
|
+
<Button variant="contained" onClick={handleLogin}>
|
|
37
|
+
Sign in (Demo)
|
|
38
|
+
</Button>
|
|
39
|
+
<Typography variant="caption">Use: admin / admin</Typography>
|
|
40
|
+
</Stack>
|
|
41
|
+
);
|
|
42
|
+
}
|