fixed: Fixed an issue where MFA forms could not be closed

This commit is contained in:
zhaojisen
2024-06-20 18:10:22 +08:00
parent b315f65bcd
commit b042bf4b55
3 changed files with 12 additions and 10 deletions

View File

@@ -469,7 +469,7 @@ export default {
// 由于组件嵌套较深,有可能导致 Error in activated hook: "TypeError: Cannot read properties of undefined (reading 'getList')" 的问题 // 由于组件嵌套较深,有可能导致 Error in activated hook: "TypeError: Cannot read properties of undefined (reading 'getList')" 的问题
setTimeout(() => { setTimeout(() => {
this.refresh() this.refresh()
}, 500) }, 300)
}, },
methods: { methods: {
onUpdateAuthDone(account) { onUpdateAuthDone(account) {

View File

@@ -131,7 +131,7 @@ export default {
this.inputPlaceholder = this.subTypeChoices.filter(item => item.name === val)[0]?.placeholder this.inputPlaceholder = this.subTypeChoices.filter(item => item.name === val)[0]?.placeholder
this.smsWidth = val === 'sms' ? 6 : 0 this.smsWidth = val === 'sms' ? 6 : 0
}, },
performConfirm: _.throttle(function({ response, callback, cancel }) { performConfirm({ response, callback, cancel }) {
if (this.processing || this.visible) { if (this.processing || this.visible) {
return return
} }
@@ -154,6 +154,7 @@ export default {
}) })
return return
} }
this.subTypeChoices = data.content this.subTypeChoices = data.content
const defaultSubType = this.subTypeChoices.filter(item => !item.disabled)[0] const defaultSubType = this.subTypeChoices.filter(item => !item.disabled)[0]
this.subTypeSelected = defaultSubType.name this.subTypeSelected = defaultSubType.name
@@ -167,7 +168,7 @@ export default {
}).finally(() => { }).finally(() => {
this.processing = false this.processing = false
}) })
}, 300), },
logout() { logout() {
window.location.href = `${process.env.VUE_APP_LOGOUT_PATH}?next=${this.$route.fullPath}` window.location.href = `${process.env.VUE_APP_LOGOUT_PATH}?next=${this.$route.fullPath}`
}, },
@@ -198,15 +199,21 @@ export default {
if (this.subTypeSelected === 'otp' && this.secretValue.length !== 6) { if (this.subTypeSelected === 'otp' && this.secretValue.length !== 6) {
return this.$message.error(this.$tc('MFAErrorMsg')) return this.$message.error(this.$tc('MFAErrorMsg'))
} }
const data = { const data = {
confirm_type: this.confirmTypeRequired, confirm_type: this.confirmTypeRequired,
mfa_type: this.confirmTypeRequired === 'mfa' ? this.subTypeSelected : '', mfa_type: this.confirmTypeRequired === 'mfa' ? this.subTypeSelected : '',
secret_key: this.secretValue secret_key: this.secretValue
} }
this.$axios.post(`/api/v1/authentication/confirm/`, data).then(res => {
this.callback() this.$axios.post(`/api/v1/authentication/confirm/`, data).then(() => {
this.secretValue = '' this.secretValue = ''
this.visible = false this.visible = false
this.$nextTick(() => {
this.callback()
})
}).catch((err) => {
this.$message.error(err.message || this.$tc('ConfirmFailed'))
}) })
} }
} }
@@ -231,5 +238,4 @@ export default {
width: 100%; width: 100%;
line-height: 20px; line-height: 20px;
} }
</style> </style>

View File

@@ -82,7 +82,3 @@ export default {
methods: {} methods: {}
} }
</script> </script>
<style scoped>
</style>