frontend/pages/auth/email-confirmation.tsx (view raw)
1import {
2 Button,
3 Card,
4 CardActions,
5 CardMedia,
6 Container,
7 Typography,
8} from '@mui/material';
9import {useTranslation} from 'next-i18next';
10import Layout from '../../layouts/Centered';
11import Logo from '../../components/Logo';
12import NextLink from 'next/link';
13import pageUtils from '../../lib/pageUtils';
14import {getSession} from 'next-auth/react';
15
16const EmailConfirmation = () => {
17 const {t} = useTranslation();
18
19 return (
20 <Layout displayMenu={false}>
21 <Container maxWidth="xs">
22 <Card sx={{pt: 2, width: '100%'}}>
23 <CardMedia component={Logo} />
24 <Typography sx={{p: 2}} variant="body2" align="center">
25 {t(`emailConfirmation.invalidMessage`)}
26 </Typography>
27 <CardActions
28 sx={{
29 flexDirection: 'column',
30 justifyContent: 'center',
31 textAlign: 'center',
32 mb: 2,
33 px: 2,
34 }}
35 >
36 <NextLink href="/auth/login" passHref>
37 <Button size="small">{t('emailConfirmation.toLogin')}</Button>
38 </NextLink>
39 </CardActions>
40 </Card>
41 </Container>
42 </Layout>
43 );
44};
45
46export const getServerSideProps = async (context: any) => {
47 const session = await getSession(context);
48
49 if (session)
50 return {
51 redirect: {
52 destination: '/',
53 permanent: false,
54 },
55 };
56 else return pageUtils.getServerSideProps()(context);
57};
58
59export default EmailConfirmation;