From a162a65cffcdc0600ccb4c6c6311b0112986a4dc Mon Sep 17 00:00:00 2001 From: Akash Upadhyay <62694340+Spectre-ak@users.noreply.github.com> Date: Thu, 23 Sep 2021 18:38:27 +0530 Subject: [PATCH] Added email confirmation page (#3573) * Added email confirmation page --- cvat-ui/src/components/cvat-app.tsx | 4 ++ .../email-confirmed.tsx | 39 +++++++++++++++++++ .../email-confirmation-page/styles.scss | 8 ++++ cvat/settings/base.py | 4 +- cvat/settings/development.py | 2 +- 5 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 cvat-ui/src/components/email-confirmation-page/email-confirmed.tsx create mode 100644 cvat-ui/src/components/email-confirmation-page/styles.scss diff --git a/cvat-ui/src/components/cvat-app.tsx b/cvat-ui/src/components/cvat-app.tsx index fca93550a466..756fe013534f 100644 --- a/cvat-ui/src/components/cvat-app.tsx +++ b/cvat-ui/src/components/cvat-app.tsx @@ -42,6 +42,7 @@ import showPlatformNotification, { showUnsupportedNotification, } from 'utils/platform-checker'; import '../styles.scss'; +import EmailConfirmationPage from './email-confirmation-page/email-confirmed'; interface CVATAppProps { loadFormats: () => void; @@ -381,6 +382,9 @@ class CVATApplication extends React.PureComponent + + + 1 ? `/auth/login/?next=${location.pathname}` : '/auth/login'} /> diff --git a/cvat-ui/src/components/email-confirmation-page/email-confirmed.tsx b/cvat-ui/src/components/email-confirmation-page/email-confirmed.tsx new file mode 100644 index 000000000000..05a4bf55d669 --- /dev/null +++ b/cvat-ui/src/components/email-confirmation-page/email-confirmed.tsx @@ -0,0 +1,39 @@ +// Copyright (C) 2021 Intel Corporation +// +// SPDX-License-Identifier: MIT + +import React, { useRef } from 'react'; +import { Link } from 'react-router-dom'; +import { Col, Row } from 'antd/lib/grid'; +import Layout from 'antd/lib/layout'; +import Statistic from 'antd/lib/statistic'; +import './styles.scss'; + +const { Content } = Layout; +const { Countdown } = Statistic; + +/** + * Component for displaying email confirmation message and then redirecting to the login page + */ + +function EmailConfirmationPage(): JSX.Element { + const linkRef = useRef(); + const onFinish = () => { + linkRef.current.click(); + }; + return ( + + + + +

Your email is confirmed

+ + Or click this link + +
+
+
+ ); +} + +export default EmailConfirmationPage; diff --git a/cvat-ui/src/components/email-confirmation-page/styles.scss b/cvat-ui/src/components/email-confirmation-page/styles.scss new file mode 100644 index 000000000000..0a60d848cbca --- /dev/null +++ b/cvat-ui/src/components/email-confirmation-page/styles.scss @@ -0,0 +1,8 @@ +// Copyright (C) 2021 Intel Corporation +// +// SPDX-License-Identifier: MIT + +#email-confirmation-page-container { + height: 100%; + text-align: center; +} diff --git a/cvat/settings/base.py b/cvat/settings/base.py index 3da6c06854ea..83d0213bbff7 100644 --- a/cvat/settings/base.py +++ b/cvat/settings/base.py @@ -238,7 +238,9 @@ def add_ssh_keys(): # https://github.com/pennersr/django-allauth ACCOUNT_EMAIL_VERIFICATION = 'none' # set UI url to redirect after a successful e-mail confirmation -ACCOUNT_EMAIL_CONFIRMATION_ANONYMOUS_REDIRECT_URL = '/auth/login' +#changed from '/auth/login' to '/auth/email-confirmation' for email confirmation message +ACCOUNT_EMAIL_CONFIRMATION_ANONYMOUS_REDIRECT_URL = '/auth/email-confirmation' + OLD_PASSWORD_FIELD_ENABLED = True # Django-RQ diff --git a/cvat/settings/development.py b/cvat/settings/development.py index 0382d41e3dd6..2474b8002e66 100644 --- a/cvat/settings/development.py +++ b/cvat/settings/development.py @@ -38,7 +38,7 @@ if UI_PORT and UI_PORT != '80': UI_URL += ':{}'.format(UI_PORT) # set UI url to redirect to after successful e-mail confirmation -ACCOUNT_EMAIL_CONFIRMATION_ANONYMOUS_REDIRECT_URL = '{}/auth/login'.format(UI_URL) +ACCOUNT_EMAIL_CONFIRMATION_ANONYMOUS_REDIRECT_URL = '{}/auth/email-confirmation'.format(UI_URL) CORS_ORIGIN_WHITELIST = [UI_URL] CORS_REPLACE_HTTPS_REFERER = True