import React, { useState } from 'react'; import { useStoreState } from 'easy-peasy'; import { ApplicationStore } from '@/state'; import tw from 'twin.macro'; import { Button } from '@/components/elements/button/index'; import DisableTwoFactorModal from '@/components/dashboard/forms/DisableTwoFactorModal'; import SetupTOTPModal from '@/components/dashboard/forms/SetupTOTPModal'; import RecoveryTokensDialog from '@/components/dashboard/forms/RecoveryTokensDialog'; export default () => { const [tokens, setTokens] = useState([]); const [visible, setVisible] = useState<'enable' | 'disable' | null>(null); const isEnabled = useStoreState((state: ApplicationStore) => state.user.data!.useTotp); const onTokens = (tokens: string[]) => { setTokens(tokens); setVisible(null); }; return (
setVisible(null)} onTokens={onTokens} /> 0} onClose={() => setTokens([])} /> setVisible(null)} />

{isEnabled ? 'Two-step verification is currently enabled on your account.' : 'You do not currently have two-step verification enabled on your account. Click the button below to begin configuring it.'}

{isEnabled ? ( setVisible('disable')}>Disable Two-Step ) : ( )}
); };