2019-06-23 01:53:50 +00:00
|
|
|
import * as React from 'react';
|
|
|
|
import ContentBox from '@/components/elements/ContentBox';
|
2019-06-26 04:28:56 +00:00
|
|
|
import UpdatePasswordForm from '@/components/dashboard/forms/UpdatePasswordForm';
|
|
|
|
import UpdateEmailAddressForm from '@/components/dashboard/forms/UpdateEmailAddressForm';
|
2019-12-23 01:03:44 +00:00
|
|
|
import ConfigureTwoFactorForm from '@/components/dashboard/forms/ConfigureTwoFactorForm';
|
2020-04-17 18:17:01 +00:00
|
|
|
import PageContentBlock from '@/components/elements/PageContentBlock';
|
2020-07-03 21:19:05 +00:00
|
|
|
import tw from 'twin.macro';
|
|
|
|
import { breakpoint } from '@/theme';
|
|
|
|
import styled from 'styled-components/macro';
|
2020-12-06 21:56:14 +00:00
|
|
|
import MessageBox from '@/components/MessageBox';
|
2021-03-21 19:07:24 +00:00
|
|
|
import { useLocation } from 'react-router-dom';
|
2019-12-23 01:03:44 +00:00
|
|
|
|
|
|
|
const Container = styled.div`
|
2020-12-06 21:56:14 +00:00
|
|
|
${tw`flex flex-wrap`};
|
2019-12-23 01:03:44 +00:00
|
|
|
|
|
|
|
& > div {
|
|
|
|
${tw`w-full`};
|
|
|
|
|
|
|
|
${breakpoint('md')`
|
|
|
|
width: calc(50% - 1rem);
|
|
|
|
`}
|
|
|
|
|
|
|
|
${breakpoint('xl')`
|
|
|
|
${tw`w-auto flex-1`};
|
|
|
|
`}
|
|
|
|
}
|
|
|
|
`;
|
2019-06-23 01:53:50 +00:00
|
|
|
|
2021-03-21 19:07:24 +00:00
|
|
|
export default () => {
|
|
|
|
const { state } = useLocation<undefined | { twoFactorRedirect?: boolean }>();
|
|
|
|
|
2019-06-23 01:53:50 +00:00
|
|
|
return (
|
2020-09-08 03:26:18 +00:00
|
|
|
<PageContentBlock title={'Account Overview'}>
|
2020-12-06 21:56:14 +00:00
|
|
|
{state?.twoFactorRedirect &&
|
|
|
|
<MessageBox title={'2-Factor Required'} type={'error'}>
|
|
|
|
Your account must have two-factor authentication enabled in order to continue.
|
|
|
|
</MessageBox>
|
|
|
|
}
|
|
|
|
<Container css={[ tw`mb-10`, state?.twoFactorRedirect ? tw`mt-4` : tw`mt-10` ]}>
|
2020-04-17 18:17:01 +00:00
|
|
|
<ContentBox title={'Update Password'} showFlashes={'account:password'}>
|
|
|
|
<UpdatePasswordForm/>
|
|
|
|
</ContentBox>
|
|
|
|
<ContentBox
|
2020-07-03 21:19:05 +00:00
|
|
|
css={tw`mt-8 md:mt-0 md:ml-8`}
|
2020-04-17 18:17:01 +00:00
|
|
|
title={'Update Email Address'}
|
|
|
|
showFlashes={'account:email'}
|
|
|
|
>
|
|
|
|
<UpdateEmailAddressForm/>
|
|
|
|
</ContentBox>
|
2020-07-03 21:19:05 +00:00
|
|
|
<ContentBox css={tw`xl:ml-8 mt-8 xl:mt-0`} title={'Configure Two Factor'}>
|
2020-04-17 18:17:01 +00:00
|
|
|
<ConfigureTwoFactorForm/>
|
|
|
|
</ContentBox>
|
|
|
|
</Container>
|
|
|
|
</PageContentBlock>
|
2019-06-23 01:53:50 +00:00
|
|
|
);
|
|
|
|
};
|