File tree Expand file tree Collapse file tree 4 files changed +7
-16
lines changed Expand file tree Collapse file tree 4 files changed +7
-16
lines changed Original file line number Diff line number Diff line change @@ -54,10 +54,7 @@ onMounted(async () => {
54
54
@success =" fetchRecoveryCodes"
55
55
#default =" { processing }"
56
56
>
57
- <Button variant =" secondary" type =" submit" :disabled =" processing" >
58
- <RefreshCw class =" mr-2 size-4" :class =" { 'animate-spin': processing }" />
59
- {{ processing ? 'Regenerating...' : 'Regenerate Codes' }}
60
- </Button >
57
+ <Button variant =" secondary" type =" submit" :disabled =" processing" > <RefreshCw /> Regenerate Codes </Button >
61
58
</Form >
62
59
</div >
63
60
<div :class =" ['relative overflow-hidden transition-all duration-300', isRecoveryCodesVisible ? 'h-auto opacity-100' : 'h-0 opacity-0']" >
Original file line number Diff line number Diff line change @@ -177,9 +177,7 @@ watch(
177
177
>
178
178
Back
179
179
</Button >
180
- <Button type =" submit" class =" w-auto flex-1" :disabled =" processing || codeValue.length < 6" >
181
- {{ processing ? 'Confirming...' : 'Confirm' }}
182
- </Button >
180
+ <Button type =" submit" class =" w-auto flex-1" :disabled =" processing || codeValue.length < 6" > Confirm </Button >
183
181
</div >
184
182
</div >
185
183
</Form >
Original file line number Diff line number Diff line change 1
1
import { qrCode , recoveryCodes , secretKey } from '@/routes/two-factor' ;
2
- import { computed , ref } from 'vue' ;
2
+ import { ref } from 'vue' ;
3
3
4
4
const fetchJson = async < T > ( url : string ) : Promise < T > => {
5
5
const response = await fetch ( url , {
@@ -17,8 +17,6 @@ const qrCodeSvg = ref<string | null>(null);
17
17
const manualSetupKey = ref < string | null > ( null ) ;
18
18
const recoveryCodesList = ref < string [ ] > ( [ ] ) ;
19
19
20
- const hasSetupData = computed < boolean > ( ( ) => qrCodeSvg . value !== null && manualSetupKey . value !== null ) ;
21
-
22
20
export const useTwoFactorAuth = ( ) => {
23
21
const fetchQrCode = async ( ) : Promise < void > => {
24
22
const { svg } = await fetchJson < { svg : string ; url : string } > ( qrCode . url ( ) ) ;
@@ -63,7 +61,6 @@ export const useTwoFactorAuth = () => {
63
61
qrCodeSvg,
64
62
manualSetupKey,
65
63
recoveryCodesList,
66
- hasSetupData,
67
64
clearSetupData,
68
65
clearTwoFactorAuthData,
69
66
fetchQrCode,
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ const breadcrumbs: BreadcrumbItem[] = [
30
30
},
31
31
];
32
32
33
- const { hasSetupData, clearTwoFactorAuthData } = useTwoFactorAuth ();
33
+ const { clearTwoFactorAuthData } = useTwoFactorAuth ();
34
34
const showSetupModal = ref <boolean >(false );
35
35
36
36
onUnmounted (() => {
@@ -54,9 +54,8 @@ onUnmounted(() => {
54
54
</p >
55
55
56
56
<div >
57
- <Button v-if =" hasSetupData" @click =" showSetupModal = true" > <ShieldCheck />Continue Setup </Button >
58
- <Form v-else v-bind =" enable.form()" @success =" showSetupModal = true" #default =" { processing }" >
59
- <Button type =" submit" :disabled =" processing" > <ShieldCheck />{{ processing ? 'Enabling...' : 'Enable 2FA' }} </Button >
57
+ <Form v-bind =" enable.form()" @success =" showSetupModal = true" #default =" { processing }" >
58
+ <Button type =" submit" :disabled =" processing" > <ShieldCheck />Enable 2FA</Button >
60
59
</Form >
61
60
</div >
62
61
</div >
@@ -75,7 +74,7 @@ onUnmounted(() => {
75
74
<Form v-bind =" disable.form()" #default =" { processing }" >
76
75
<Button variant =" destructive" type =" submit" :disabled =" processing" >
77
76
<ShieldBan />
78
- {{ processing ? 'Disabling...' : ' Disable 2FA' }}
77
+ Disable 2FA
79
78
</Button >
80
79
</Form >
81
80
</div >
You can’t perform that action at this time.
0 commit comments