accounts-frontend/src/components/profile/multiFactorAuth/MultiFactorAuth.js

75 lines
2.2 KiB
JavaScript
Raw Normal View History

2017-07-22 21:27:38 +05:30
// @flow
import React, { Component } from 'react';
import Helmet from 'react-helmet';
2017-09-09 19:52:19 +05:30
import { FormattedMessage as Message } from 'react-intl';
2017-07-22 21:27:38 +05:30
import styles from 'components/profile/profileForm.scss';
2017-09-09 19:52:19 +05:30
import { BackButton } from 'components/profile/ProfileForm';
2017-07-22 21:27:38 +05:30
2017-09-09 19:52:19 +05:30
import MfaEnable from './MfaEnable';
import MfaDisable from './MfaDisable';
2017-07-22 21:27:38 +05:30
import messages from './MultiFactorAuth.intl.json';
2017-09-09 19:52:19 +05:30
import type { MfaStep } from './MfaEnable';
2017-09-09 19:52:19 +05:30
class MultiFactorAuth extends Component<{
step: MfaStep,
isMfaEnabled: bool,
onSubmit: Function,
onComplete: Function,
2017-09-09 19:52:19 +05:30
onChangeStep: Function
2017-08-23 02:01:41 +05:30
}> {
2017-07-22 21:27:38 +05:30
render() {
2017-09-09 19:52:19 +05:30
const {
step,
onSubmit,
onComplete,
onChangeStep,
isMfaEnabled
} = this.props;
2017-07-22 21:27:38 +05:30
return (
<div className={styles.contentWithBackButton}>
<BackButton />
<div className={styles.form}>
<div className={styles.formBody}>
<Message {...messages.mfaTitle}>
{(pageTitle) => (
<h3 className={styles.title}>
<Helmet title={pageTitle} />
{pageTitle}
</h3>
)}
</Message>
<div className={styles.formRow}>
<p className={styles.description}>
<Message {...messages.mfaDescription} />
</p>
2017-07-22 21:27:38 +05:30
</div>
</div>
2017-09-09 19:52:19 +05:30
{isMfaEnabled && (
<MfaDisable
onSubmit={onSubmit}
onComplete={onComplete}
/>
)}
</div>
2017-07-22 21:27:38 +05:30
2017-09-09 19:52:19 +05:30
{isMfaEnabled || (
<MfaEnable
step={step}
onSubmit={onSubmit}
onChangeStep={onChangeStep}
onComplete={onComplete}
/>
2017-09-09 19:52:19 +05:30
)}
</div>
2017-07-22 21:27:38 +05:30
);
}
}
2017-09-09 19:52:19 +05:30
export default MultiFactorAuth;