|
1 | 1 | <script setup>
|
2 |
| -import { ref, computed } from 'vue'; |
| 2 | +import { ref, computed, watch } from 'vue'; |
3 | 3 | import { Inertia } from '@inertiajs/inertia';
|
4 | 4 | import { useForm, usePage } from '@inertiajs/inertia-vue3';
|
5 | 5 | import JetActionSection from '@/Jetstream/ActionSection.vue';
|
@@ -30,6 +30,13 @@ const twoFactorEnabled = computed(
|
30 | 30 | () => ! enabling.value && usePage().props.value.user.two_factor_enabled,
|
31 | 31 | );
|
32 | 32 |
|
| 33 | +watch(twoFactorEnabled, () => { |
| 34 | + if (! twoFactorEnabled.value) { |
| 35 | + confirmationForm.reset(); |
| 36 | + confirmationForm.clearErrors(); |
| 37 | + } |
| 38 | +}); |
| 39 | +
|
33 | 40 | const enableTwoFactorAuthentication = () => {
|
34 | 41 | enabling.value = true;
|
35 | 42 |
|
@@ -67,6 +74,7 @@ const showRecoveryCodes = () => {
|
67 | 74 |
|
68 | 75 | const confirmTwoFactorAuthentication = () => {
|
69 | 76 | confirmationForm.post('/user/confirmed-two-factor-authentication', {
|
| 77 | + errorBag: "confirmTwoFactorAuthentication", |
70 | 78 | preserveScroll: true,
|
71 | 79 | preserveState: true,
|
72 | 80 | onSuccess: () => {
|
@@ -111,7 +119,7 @@ const disableTwoFactorAuthentication = () => {
|
111 | 119 | You have enabled two factor authentication.
|
112 | 120 | </h3>
|
113 | 121 |
|
114 |
| - <h3 v-else-if="confirming" class="text-lg font-medium text-gray-900"> |
| 122 | + <h3 v-else-if="twoFactorEnabled && confirming" class="text-lg font-medium text-gray-900"> |
115 | 123 | Finish enabling two factor authentication.
|
116 | 124 | </h3>
|
117 | 125 |
|
|
0 commit comments