reset state after leaving 2fa setting tab

This commit is contained in:
MaysWind
2023-07-01 23:10:49 +08:00
parent 88b6ecc557
commit 153e0035ba
2 changed files with 23 additions and 1 deletions
+8 -1
View File
@@ -29,7 +29,7 @@
</v-window-item> </v-window-item>
<v-window-item value="twoFactorSetting"> <v-window-item value="twoFactorSetting">
<user-two-factor-auth-setting-tab/> <user-two-factor-auth-setting-tab ref="twoFactorSettingTab"/>
</v-window-item> </v-window-item>
<v-window-item value="dataManagementSetting"> <v-window-item value="dataManagementSetting">
@@ -69,6 +69,13 @@ export default {
dataManagementSetting: mdiDatabaseCogOutline dataManagementSetting: mdiDatabaseCogOutline
} }
}; };
},
watch: {
'activeTab': function (newValue, oldValue) {
if (oldValue === 'twoFactorSetting' && newValue !== 'twoFactorSetting') {
this.$refs.twoFactorSettingTab.reset();
}
}
} }
} }
</script> </script>
@@ -116,6 +116,9 @@ import {
} from '@mdi/js'; } from '@mdi/js';
export default { export default {
expose: [
'reset'
],
data() { data() {
return { return {
status: null, status: null,
@@ -165,6 +168,18 @@ export default {
} }
}, },
methods: { methods: {
reset() {
this.new2FASecret = '';
this.new2FAQRCode = '';
this.currentPassword = '';
this.isCurrentPasswordVisible = false;
this.currentPasscode = '';
this.currentBackupCode = '';
this.enabling = false;
this.enableConfirming = false;
this.disabling = false;
this.regenerating = false;
},
enable() { enable() {
const self = this; const self = this;