未验证 提交 a162a65c 编写于 作者: A Akash Upadhyay 提交者: GitHub

Added email confirmation page (#3573)

* Added email confirmation page
上级 f3e09cdd
......@@ -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<CVATAppProps & RouteComponentP
path='/auth/password/reset/confirm'
component={ResetPasswordPageConfirmComponent}
/>
<Route exact path='/auth/email-confirmation' component={EmailConfirmationPage} />
<Redirect
to={location.pathname.length > 1 ? `/auth/login/?next=${location.pathname}` : '/auth/login'}
/>
......
// 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 (
<Layout>
<Content>
<Row justify='center' align='middle' id='email-confirmation-page-container'>
<Col>
<h1>Your email is confirmed</h1>
<Countdown format='ss' title='Redirecting to login page after...' value={Date.now() + 1000 * 6} onFinish={onFinish} />
<Link to='/auth/login' ref={linkRef}>Or click this link</Link>
</Col>
</Row>
</Content>
</Layout>
);
}
export default EmailConfirmationPage;
// Copyright (C) 2021 Intel Corporation
//
// SPDX-License-Identifier: MIT
#email-confirmation-page-container {
height: 100%;
text-align: center;
}
......@@ -238,7 +238,9 @@ AUTHENTICATION_BACKENDS = [
# 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
......
......@@ -38,7 +38,7 @@ UI_URL = '{}://{}'.format(UI_SCHEME, UI_HOST)
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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册