@applica-software-guru/react-admin 1.0.75 → 1.0.76
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/components/Layout/index.d.ts.map +1 -1
- package/dist/components/ra-forms/ChangePasswordForm.d.ts +2 -1
- package/dist/components/ra-forms/ChangePasswordForm.d.ts.map +1 -1
- package/dist/react-admin.cjs.js +45 -45
- package/dist/react-admin.cjs.js.map +1 -1
- package/dist/react-admin.es.js +14976 -14969
- package/dist/react-admin.es.js.map +1 -1
- package/dist/react-admin.umd.js +48 -48
- package/dist/react-admin.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Layout/Header/HeaderContent/Profile.jsx +1 -1
- package/src/components/Layout/index.jsx +12 -1
- package/src/components/ra-forms/ChangePasswordForm.tsx +13 -3
package/package.json
CHANGED
|
@@ -27,7 +27,7 @@ const Profile = () => {
|
|
|
27
27
|
const theme = useTheme();
|
|
28
28
|
|
|
29
29
|
const { identity } = useGetIdentity();
|
|
30
|
-
const hasProfilePic = identity !== undefined && identity.image !== null && identity.image !== '';
|
|
30
|
+
const hasProfilePic = identity !== undefined && identity.image && identity.image !== null && identity.image !== '';
|
|
31
31
|
const anchorRef = useRef(null);
|
|
32
32
|
const [open, setOpen] = useState(false);
|
|
33
33
|
const handleToggle = () => {
|
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
import 'simplebar/dist/simplebar.css';
|
|
2
2
|
|
|
3
|
-
import { Box, Container, Toolbar, useMediaQuery } from '@mui/material';
|
|
3
|
+
import { Box, Container, Dialog, Toolbar, useMediaQuery } from '@mui/material';
|
|
4
4
|
import { useBreadcrumbs, useMenuConfig, useThemeConfig } from '../../hooks';
|
|
5
5
|
import { useEffect, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import Breadcrumbs from '../@extended/Breadcrumbs';
|
|
8
|
+
import { ChangePasswordForm } from '../ra-forms';
|
|
8
9
|
import Drawer from './Drawer';
|
|
9
10
|
import Footer from './Footer';
|
|
10
11
|
import Header from './Header';
|
|
11
12
|
import HorizontalBar from './Drawer/HorizontalBar';
|
|
12
13
|
import { Outlet } from 'react-router-dom';
|
|
13
14
|
import PropTypes from 'prop-types';
|
|
15
|
+
import { useGetIdentity } from 'ra-core';
|
|
14
16
|
import { useTheme } from '@mui/material/styles';
|
|
15
17
|
|
|
16
18
|
const Layout = ({ children, name, version, logoMain, logoIcon, notification, enableNotification }) => {
|
|
17
19
|
const theme = useTheme();
|
|
18
20
|
const { openDrawer } = useMenuConfig();
|
|
19
21
|
const { isLoading, navigation, breadcrumbs } = useBreadcrumbs();
|
|
22
|
+
const { identity } = useGetIdentity();
|
|
23
|
+
const [needToChangePassword, setNeedToChangePassword] = useState(false);
|
|
24
|
+
|
|
20
25
|
const matchDownLG = useMediaQuery(theme.breakpoints.down('xl'));
|
|
21
26
|
const downLG = useMediaQuery(theme.breakpoints.down('lg'));
|
|
22
27
|
const { container, miniDrawer, menuOrientation, isHorizontalLayout } = useThemeConfig();
|
|
@@ -28,6 +33,7 @@ const Layout = ({ children, name, version, logoMain, logoIcon, notification, ena
|
|
|
28
33
|
setOpen(!open);
|
|
29
34
|
openDrawer(!open);
|
|
30
35
|
};
|
|
36
|
+
useEffect(() => setNeedToChangePassword(identity?.needToChangePassword === true), [identity]);
|
|
31
37
|
useEffect(() => {
|
|
32
38
|
if (!miniDrawer) {
|
|
33
39
|
setOpen(!matchDownLG);
|
|
@@ -41,6 +47,8 @@ const Layout = ({ children, name, version, logoMain, logoIcon, notification, ena
|
|
|
41
47
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
42
48
|
}, [drawerOpen]);
|
|
43
49
|
|
|
50
|
+
const handlePasswordChange = () => setNeedToChangePassword(false);
|
|
51
|
+
|
|
44
52
|
return (
|
|
45
53
|
<Box sx={{ display: 'flex', width: '100%' }}>
|
|
46
54
|
<Header
|
|
@@ -68,6 +76,9 @@ const Layout = ({ children, name, version, logoMain, logoIcon, notification, ena
|
|
|
68
76
|
flexDirection: 'column'
|
|
69
77
|
}}
|
|
70
78
|
>
|
|
79
|
+
<Dialog open={needToChangePassword} maxWidth="xs" fullWidth>
|
|
80
|
+
<ChangePasswordForm onSuccess={handlePasswordChange} firstAccess />
|
|
81
|
+
</Dialog>
|
|
71
82
|
{!isLoading && (
|
|
72
83
|
<Breadcrumbs
|
|
73
84
|
titleBottom
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Alert, AlertTitle, Grid } from '@mui/material';
|
|
2
|
+
import { EditContextProvider, ResourceContextProvider, required, useAuthProvider, useNotify, useTranslate } from 'ra-core';
|
|
2
3
|
import { useCallback, useState } from 'react';
|
|
3
4
|
|
|
4
|
-
import { Grid } from '@mui/material';
|
|
5
5
|
import { SaveButton } from 'ra-ui-materialui';
|
|
6
6
|
import SimpleForm from './SimpleForm';
|
|
7
7
|
import { TextInput } from '../ra-inputs';
|
|
@@ -10,11 +10,13 @@ import { useThemeConfig } from '../../hooks';
|
|
|
10
10
|
|
|
11
11
|
export type ChangePasswordFormProps = {
|
|
12
12
|
onSuccess: () => void;
|
|
13
|
+
firstAccess?: boolean;
|
|
13
14
|
};
|
|
14
|
-
const ChangePasswordForm = ({ onSuccess }: ChangePasswordFormProps) => {
|
|
15
|
+
const ChangePasswordForm = ({ onSuccess, firstAccess }: ChangePasswordFormProps) => {
|
|
15
16
|
const { spacing } = useThemeConfig();
|
|
16
17
|
const [saving, setSaving] = useState(false);
|
|
17
18
|
const authProvider = useAuthProvider();
|
|
19
|
+
const translate = useTranslate();
|
|
18
20
|
const notify = useNotify();
|
|
19
21
|
const handleSubmit = useCallback(
|
|
20
22
|
(data: any) => {
|
|
@@ -50,6 +52,14 @@ const ChangePasswordForm = ({ onSuccess }: ChangePasswordFormProps) => {
|
|
|
50
52
|
}
|
|
51
53
|
>
|
|
52
54
|
<Grid container spacing={spacing}>
|
|
55
|
+
{firstAccess === true && (
|
|
56
|
+
<Grid item xs={12}>
|
|
57
|
+
<Alert severity="warning">
|
|
58
|
+
<AlertTitle>{translate('ra.auth.first_access.change_password')}</AlertTitle>
|
|
59
|
+
{translate('ra.auth.first_access.change_password_helper')}
|
|
60
|
+
</Alert>
|
|
61
|
+
</Grid>
|
|
62
|
+
)}
|
|
53
63
|
<Grid item xs={12}>
|
|
54
64
|
<TextInput source="oldPassword" type="password" validate={required()} />
|
|
55
65
|
</Grid>
|