2017-08-23 00:19:50 +05:30
|
|
|
|
import React from 'react';
|
2016-05-15 02:23:58 +05:30
|
|
|
|
|
2020-06-04 22:11:27 +05:30
|
|
|
|
import { defineMessages, FormattedMessage as Message } from 'react-intl';
|
2016-05-15 02:23:58 +05:30
|
|
|
|
|
2019-12-08 00:32:00 +05:30
|
|
|
|
import { Input } from 'app/components/ui/form';
|
|
|
|
|
import BaseAuthBody from 'app/components/auth/BaseAuthBody';
|
2016-05-15 02:23:58 +05:30
|
|
|
|
|
|
|
|
|
import styles from './recoverPassword.scss';
|
|
|
|
|
|
|
|
|
|
// TODO: activation code field may be decoupled into common component and reused here and in activation panel
|
|
|
|
|
|
2020-06-04 22:11:27 +05:30
|
|
|
|
const placeholders = defineMessages({
|
|
|
|
|
newPassword: 'Enter new password',
|
|
|
|
|
newRePassword: 'Repeat new password',
|
|
|
|
|
enterTheCode: 'Enter confirmation code',
|
|
|
|
|
});
|
|
|
|
|
|
2016-05-15 02:23:58 +05:30
|
|
|
|
export default class RecoverPasswordBody extends BaseAuthBody {
|
2020-05-24 04:38:24 +05:30
|
|
|
|
static displayName = 'RecoverPasswordBody';
|
|
|
|
|
static panelId = 'recoverPassword';
|
|
|
|
|
static hasGoBack = true;
|
2016-05-15 02:23:58 +05:30
|
|
|
|
|
2020-05-24 04:38:24 +05:30
|
|
|
|
autoFocusField = this.props.match.params && this.props.match.params.key ? 'newPassword' : 'key';
|
2016-05-15 02:23:58 +05:30
|
|
|
|
|
2020-05-24 04:38:24 +05:30
|
|
|
|
render() {
|
|
|
|
|
const { user } = this.context;
|
|
|
|
|
const { key } = this.props.match.params;
|
2016-05-15 02:23:58 +05:30
|
|
|
|
|
2020-05-24 04:38:24 +05:30
|
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
{this.renderErrors()}
|
2016-05-15 02:23:58 +05:30
|
|
|
|
|
2020-05-24 04:38:24 +05:30
|
|
|
|
<p className={styles.descriptionText}>
|
|
|
|
|
{user.maskedEmail ? (
|
|
|
|
|
<Message
|
2020-06-04 22:11:27 +05:30
|
|
|
|
key="messageWasSentTo"
|
|
|
|
|
defaultMessage="The recovery code was sent to your E‑mail {email}."
|
2020-05-24 04:38:24 +05:30
|
|
|
|
values={{
|
|
|
|
|
email: <b>{user.maskedEmail}</b>,
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
) : (
|
2020-06-04 22:11:27 +05:30
|
|
|
|
<Message
|
|
|
|
|
key="messageWasSent"
|
|
|
|
|
defaultMessage="The recovery code was sent to your account E‑mail."
|
|
|
|
|
/>
|
2020-05-24 04:38:24 +05:30
|
|
|
|
)}{' '}
|
2020-06-04 22:11:27 +05:30
|
|
|
|
<Message
|
|
|
|
|
key="enterCodeBelow"
|
|
|
|
|
defaultMessage="Please enter the code received into the field below:"
|
|
|
|
|
/>
|
2020-05-24 04:38:24 +05:30
|
|
|
|
</p>
|
2016-05-15 02:23:58 +05:30
|
|
|
|
|
2020-05-24 04:38:24 +05:30
|
|
|
|
<Input
|
|
|
|
|
{...this.bindField('key')}
|
|
|
|
|
color="lightViolet"
|
|
|
|
|
center
|
|
|
|
|
required
|
|
|
|
|
value={key}
|
|
|
|
|
readOnly={!!key}
|
|
|
|
|
autoComplete="off"
|
2020-06-04 22:11:27 +05:30
|
|
|
|
placeholder={placeholders.enterTheCode}
|
2020-05-24 04:38:24 +05:30
|
|
|
|
/>
|
2016-05-15 02:23:58 +05:30
|
|
|
|
|
2020-05-24 04:38:24 +05:30
|
|
|
|
<p className={styles.descriptionText}>
|
2020-06-04 22:11:27 +05:30
|
|
|
|
<Message key="enterNewPasswordBelow" defaultMessage="Enter and repeat new password below:" />
|
2020-05-24 04:38:24 +05:30
|
|
|
|
</p>
|
2016-05-15 02:23:58 +05:30
|
|
|
|
|
2020-05-24 04:38:24 +05:30
|
|
|
|
<Input
|
|
|
|
|
{...this.bindField('newPassword')}
|
|
|
|
|
icon="key"
|
|
|
|
|
color="lightViolet"
|
|
|
|
|
type="password"
|
|
|
|
|
required
|
2020-06-04 22:11:27 +05:30
|
|
|
|
placeholder={placeholders.newPassword}
|
2020-05-24 04:38:24 +05:30
|
|
|
|
/>
|
2016-05-15 02:23:58 +05:30
|
|
|
|
|
2020-05-24 04:38:24 +05:30
|
|
|
|
<Input
|
|
|
|
|
{...this.bindField('newRePassword')}
|
|
|
|
|
icon="key"
|
|
|
|
|
color="lightViolet"
|
|
|
|
|
type="password"
|
|
|
|
|
required
|
2020-06-04 22:11:27 +05:30
|
|
|
|
placeholder={placeholders.newRePassword}
|
2020-05-24 04:38:24 +05:30
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
2016-05-15 02:23:58 +05:30
|
|
|
|
}
|