58 lines
2.1 KiB
TypeScript
Raw Normal View History

2019-12-07 13:28:52 +02:00
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 17:22:19 +03:00
import mfaStyles from './mfa.scss';
const messages = defineMessages({
codePlaceholder: 'Enter the code here',
});
2017-09-09 17:22:19 +03:00
2019-12-07 13:28:52 +02:00
export default class MfaDisableForm extends React.Component<{
2020-05-24 02:08:24 +03:00
onSubmit: (form: FormModel) => Promise<void>;
2017-09-09 17:22:19 +03:00
}> {
2020-05-24 02:08:24 +03:00
form: FormModel = new FormModel();
2020-05-24 02:08:24 +03:00
render() {
const { form } = this;
const { onSubmit } = this.props;
2020-05-24 02:08:24 +03:00
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 02:08:24 +03:00
</p>
</div>
2020-05-24 02:08:24 +03:00
<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 02:08:24 +03:00
</p>
</div>
2020-05-24 02:08:24 +03:00
<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 02:08:24 +03:00
</Form>
);
}
2017-09-09 17:22:19 +03:00
}