feat: disable non-cloud features
This commit is contained in:
@@ -7,6 +7,7 @@ import Typography from '@mui/material/Typography';
|
||||
import LoadingButton from '@mui/lab/LoadingButton';
|
||||
|
||||
import useAuthentication from 'hooks/useAuthentication';
|
||||
import useCloud from 'hooks/useCloud';
|
||||
import * as URLS from 'config/urls';
|
||||
import { LOGIN } from 'graphql/mutations/login';
|
||||
import Form from 'components/Form';
|
||||
@@ -14,6 +15,7 @@ import TextField from 'components/TextField';
|
||||
import useFormatMessage from 'hooks/useFormatMessage';
|
||||
|
||||
function LoginForm() {
|
||||
const isCloud = useCloud();
|
||||
const navigate = useNavigate();
|
||||
const formatMessage = useFormatMessage();
|
||||
const authentication = useAuthentication();
|
||||
@@ -76,13 +78,13 @@ function LoginForm() {
|
||||
sx={{ mb: 1 }}
|
||||
/>
|
||||
|
||||
<Link
|
||||
{isCloud &&<Link
|
||||
component={RouterLink}
|
||||
to={URLS.FORGOT_PASSWORD}
|
||||
underline="none"
|
||||
>
|
||||
{formatMessage('loginForm.forgotPasswordText')}
|
||||
</Link>
|
||||
</Link>}
|
||||
|
||||
<LoadingButton
|
||||
type="submit"
|
||||
@@ -96,13 +98,13 @@ function LoginForm() {
|
||||
{formatMessage('loginForm.submit')}
|
||||
</LoadingButton>
|
||||
|
||||
<Typography variant="body1" align="center" mt={3}>
|
||||
{isCloud && <Typography variant="body1" align="center" mt={3}>
|
||||
{formatMessage('loginForm.noAccount')}
|
||||
|
||||
<Link component={RouterLink} to={URLS.SIGNUP} underline="none">
|
||||
{formatMessage('loginForm.signUp')}
|
||||
</Link>
|
||||
</Typography>
|
||||
</Typography>}
|
||||
</Form>
|
||||
</Paper>
|
||||
);
|
||||
|
@@ -1,7 +1,20 @@
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
|
||||
import useAutomatischInfo from './useAutomatischInfo';
|
||||
|
||||
export default function useCloud(): boolean {
|
||||
type UseCloudOptions = {
|
||||
redirect?: boolean;
|
||||
}
|
||||
|
||||
export default function useCloud(options?: UseCloudOptions): boolean {
|
||||
const redirect = options?.redirect || false;
|
||||
|
||||
const { isCloud } = useAutomatischInfo();
|
||||
const navigate = useNavigate();
|
||||
|
||||
if (isCloud === false && redirect) {
|
||||
navigate('/');
|
||||
}
|
||||
|
||||
return isCloud;
|
||||
}
|
||||
|
@@ -12,13 +12,14 @@ import routes from 'routes';
|
||||
import reportWebVitals from './reportWebVitals';
|
||||
|
||||
ReactDOM.render(
|
||||
<Router>
|
||||
<SnackbarProvider>
|
||||
<AuthenticationProvider>
|
||||
<ApolloProvider>
|
||||
<AutomatischInfoProvider>
|
||||
<IntlProvider>
|
||||
<ThemeProvider>
|
||||
<Router>{routes}</Router>
|
||||
{routes}
|
||||
|
||||
<LiveChat />
|
||||
</ThemeProvider>
|
||||
@@ -26,7 +27,8 @@ ReactDOM.render(
|
||||
</AutomatischInfoProvider>
|
||||
</ApolloProvider>
|
||||
</AuthenticationProvider>
|
||||
</SnackbarProvider>,
|
||||
</SnackbarProvider>
|
||||
</Router>,
|
||||
document.getElementById('root')
|
||||
);
|
||||
|
||||
|
@@ -1,9 +1,13 @@
|
||||
import * as React from 'react';
|
||||
import Box from '@mui/material/Box';
|
||||
|
||||
import useCloud from 'hooks/useCloud';
|
||||
import Container from 'components/Container';
|
||||
import ForgotPasswordForm from 'components/ForgotPasswordForm/index.ee';
|
||||
|
||||
export default function ForgotPassword(): React.ReactElement {
|
||||
useCloud({ redirect: true });
|
||||
|
||||
return (
|
||||
<Box sx={{ display: 'flex', flex: 1, alignItems: 'center' }}>
|
||||
<Container maxWidth="sm">
|
||||
|
@@ -1,9 +1,13 @@
|
||||
import * as React from 'react';
|
||||
import Box from '@mui/material/Box';
|
||||
|
||||
import useCloud from 'hooks/useCloud';
|
||||
import Container from 'components/Container';
|
||||
import ResetPasswordForm from 'components/ResetPasswordForm/index.ee';
|
||||
|
||||
export default function ResetPassword(): React.ReactElement {
|
||||
useCloud({ redirect: true });
|
||||
|
||||
return (
|
||||
<Box sx={{ display: 'flex', flex: 1, alignItems: 'center' }}>
|
||||
<Container maxWidth="sm">
|
||||
|
@@ -1,9 +1,13 @@
|
||||
import * as React from 'react';
|
||||
import Box from '@mui/material/Box';
|
||||
|
||||
import useCloud from 'hooks/useCloud';
|
||||
import Container from 'components/Container';
|
||||
import SignUpForm from 'components/SignUpForm/index.ee';
|
||||
|
||||
export default function Login(): React.ReactElement {
|
||||
export default function SignUp(): React.ReactElement {
|
||||
useCloud({ redirect: true });
|
||||
|
||||
return (
|
||||
<Box sx={{ display: 'flex', flex: 1, alignItems: 'center' }}>
|
||||
<Container maxWidth="sm">
|
||||
|
Reference in New Issue
Block a user