forked from pterodactyl/panel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfigureTwoFactorForm.tsx
More file actions
55 lines (53 loc) · 1.82 KB
/
ConfigureTwoFactorForm.tsx
File metadata and controls
55 lines (53 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import React, { useState } from 'react';
import { useStoreState } from 'easy-peasy';
import { ApplicationStore } from '@/state';
import SetupTwoFactorModal from '@/components/dashboard/forms/SetupTwoFactorModal';
import DisableTwoFactorModal from '@/components/dashboard/forms/DisableTwoFactorModal';
export default () => {
const user = useStoreState((state: ApplicationStore) => state.user.data!);
const [ visible, setVisible ] = useState(false);
return user.useTotp ?
<div>
{visible &&
<DisableTwoFactorModal
appear={true}
visible={visible}
onDismissed={() => setVisible(false)}
/>
}
<p className={'text-sm'}>
Two-factor authentication is currently enabled on your account.
</p>
<div className={'mt-6'}>
<button
onClick={() => setVisible(true)}
className={'btn btn-red btn-secondary btn-sm'}
>
Disable
</button>
</div>
</div>
:
<div>
{visible &&
<SetupTwoFactorModal
appear={true}
visible={visible}
onDismissed={() => setVisible(false)}
/>
}
<p className={'text-sm'}>
You do not currently have two-factor authentication enabled on your account. Click
the button below to begin configuring it.
</p>
<div className={'mt-6'}>
<button
onClick={() => setVisible(true)}
className={'btn btn-green btn-secondary btn-sm'}
>
Begin Setup
</button>
</div>
</div>
;
};