accounts-frontend/packages/app/components/profile/multiFactorAuth/MfaDisableForm.tsx

58 lines
2.1 KiB
TypeScript
Raw Permalink Normal View History

2019-12-07 16:58:52 +05:30
import React from 'react';
import { defineMessages, FormattedMessage as Message } from 'react-intl';
import { Button, Input, Form, FormModel } from 'app/components/ui/form';
import styles from 'app/components/profile/profileForm.scss';
2017-09-09 19:52:19 +05:30
import mfaStyles from './mfa.scss';
const messages = defineMessages({
codePlaceholder: 'Enter the code here',
});
2017-09-09 19:52:19 +05:30
2019-12-07 16:58:52 +05:30
export default class MfaDisableForm extends React.Component<{
2020-05-24 04:38:24 +05:30
onSubmit: (form: FormModel) => Promise<void>;
2017-09-09 19:52:19 +05:30
}> {
2020-05-24 04:38:24 +05:30
form: FormModel = new FormModel();
2020-05-24 04:38:24 +05:30
render() {
const { form } = this;
const { onSubmit } = this.props;
2020-05-24 04:38:24 +05:30
return (
<Form form={form} onSubmit={onSubmit}>
<div className={styles.formBody}>
<div className={styles.formRow}>
<p className={`${styles.description} ${mfaStyles.mfaTitle}`}>
<Message key="disableMfa" defaultMessage="Disable twofactor authentication" />
2020-05-24 04:38:24 +05:30
</p>
</div>
2020-05-24 04:38:24 +05:30
<div className={styles.formRow}>
<p className={styles.description}>
<Message
key="disableMfaInstruction"
defaultMessage="In order to disable twofactor authentication, you need to provide a code from your mobile app and confirm your action with your current account password."
/>
2020-05-24 04:38:24 +05:30
</p>
</div>
2020-05-24 04:38:24 +05:30
<div className={styles.formRow}>
<Input
{...form.bindField('totp')}
required
autoFocus
autoComplete="off"
skin="light"
placeholder={messages.codePlaceholder}
/>
</div>
</div>
<Button type="submit" color="green" block>
<Message key="disable" defaultMessage="Disable" />
</Button>
2020-05-24 04:38:24 +05:30
</Form>
);
}
2017-09-09 19:52:19 +05:30
}