2019-12-07 16:58:52 +05:30
import React from 'react' ;
2020-06-04 22:11:27 +05:30
import { defineMessages , FormattedMessage as Message } from 'react-intl' ;
2019-12-08 00:32:00 +05:30
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
2020-06-04 22:11:27 +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 ( ) ;
2019-11-27 14:33:32 +05:30
2020-05-24 04:38:24 +05:30
render() {
const { form } = this ;
const { onSubmit } = this . props ;
2019-11-27 14:33:32 +05:30
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 } ` } >
2020-06-04 22:11:27 +05:30
< Message key = "disableMfa" defaultMessage = "Disable two‑ factor authentication" / >
2020-05-24 04:38:24 +05:30
< / p >
< / div >
2019-11-27 14:33:32 +05:30
2020-05-24 04:38:24 +05:30
< div className = { styles . formRow } >
< p className = { styles . description } >
2020-06-04 22:11:27 +05:30
< Message
key = "disableMfaInstruction"
defaultMessage = "In order to disable two‑ factor 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 >
2019-11-27 14:33:32 +05:30
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 >
2019-11-27 14:33:32 +05:30
2020-07-22 16:50:10 +05:30
< 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
}