Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pterodactyl
GitHub Repository: pterodactyl/panel
Path: blob/1.0-develop/resources/scripts/components/dashboard/AccountOverviewContainer.tsx
7461 views
1
import * as React from 'react';
2
import ContentBox from '@/components/elements/ContentBox';
3
import UpdatePasswordForm from '@/components/dashboard/forms/UpdatePasswordForm';
4
import UpdateEmailAddressForm from '@/components/dashboard/forms/UpdateEmailAddressForm';
5
import ConfigureTwoFactorForm from '@/components/dashboard/forms/ConfigureTwoFactorForm';
6
import PageContentBlock from '@/components/elements/PageContentBlock';
7
import tw from 'twin.macro';
8
import { breakpoint } from '@/theme';
9
import styled from 'styled-components/macro';
10
import MessageBox from '@/components/MessageBox';
11
import { useLocation } from 'react-router-dom';
12
13
const Container = styled.div`
14
${tw`flex flex-wrap`};
15
16
& > div {
17
${tw`w-full`};
18
19
${breakpoint('sm')`
20
width: calc(50% - 1rem);
21
`}
22
23
${breakpoint('md')`
24
${tw`w-auto flex-1`};
25
`}
26
}
27
`;
28
29
export default () => {
30
const { state } = useLocation<undefined | { twoFactorRedirect?: boolean }>();
31
32
return (
33
<PageContentBlock title={'Account Overview'}>
34
{state?.twoFactorRedirect && (
35
<MessageBox title={'2-Factor Required'} type={'error'}>
36
Your account must have two-factor authentication enabled in order to continue.
37
</MessageBox>
38
)}
39
40
<Container css={[tw`lg:grid lg:grid-cols-3 mb-10`, state?.twoFactorRedirect ? tw`mt-4` : tw`mt-10`]}>
41
<ContentBox title={'Update Password'} showFlashes={'account:password'}>
42
<UpdatePasswordForm />
43
</ContentBox>
44
<ContentBox css={tw`mt-8 sm:mt-0 sm:ml-8`} title={'Update Email Address'} showFlashes={'account:email'}>
45
<UpdateEmailAddressForm />
46
</ContentBox>
47
<ContentBox css={tw`md:ml-8 mt-8 md:mt-0`} title={'Two-Step Verification'}>
48
<ConfigureTwoFactorForm />
49
</ContentBox>
50
</Container>
51
</PageContentBlock>
52
);
53
};
54
55