forked from processing/p5.js-web-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNewPasswordView.jsx
More file actions
56 lines (51 loc) · 1.78 KB
/
Copy pathNewPasswordView.jsx
File metadata and controls
56 lines (51 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import React, { useEffect } from 'react';
import classNames from 'classnames';
import { useDispatch, useSelector } from 'react-redux';
import { Helmet } from 'react-helmet';
import { useTranslation } from 'react-i18next';
import { useParams } from 'react-router-dom';
import NewPasswordForm from '../components/NewPasswordForm';
import { validateResetPasswordToken } from '../actions';
import Nav from '../../IDE/components/Header/Nav';
import RootPage from '../../../components/RootPage';
import { useWhatPage } from '../../IDE/hooks';
function NewPasswordView() {
const { t } = useTranslation();
const pageName = useWhatPage();
const pagetitle = String(t(pageName));
const params = useParams();
const resetPasswordToken = params.reset_password_token;
const resetPasswordInvalid = useSelector(
(state) => state.user.resetPasswordInvalid
);
const dispatch = useDispatch();
useEffect(() => {
dispatch(validateResetPasswordToken(resetPasswordToken));
}, [resetPasswordToken]);
const newPasswordClass = classNames({
'new-password': true,
'new-password--invalid': resetPasswordInvalid,
'form-container': true,
user: true
});
return (
<RootPage>
<Nav layout="dashboard" mobileTitle={pagetitle} />
<div className={newPasswordClass}>
<Helmet>
<title>{t('NewPasswordView.Title')}</title>
</Helmet>
<div className="form-container__content">
<h2 className="form-container__title">
{t('NewPasswordView.Description')}
</h2>
<NewPasswordForm resetPasswordToken={resetPasswordToken} />
<p className="new-password__invalid">
{t('NewPasswordView.TokenInvalidOrExpired')}
</p>
</div>
</div>
</RootPage>
);
}
export default NewPasswordView;