mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-25 14:25:23 +00:00
[fix]vault
This commit is contained in:
@@ -142,7 +142,18 @@ export default {
|
||||
type: 'primary',
|
||||
callback: function(val) {
|
||||
this.MFAInfo.asset = val.cellValue
|
||||
this.showMFADialog = true
|
||||
if (this.MFAVerifyAt + this.MFA_TTl * 1000 > (new Date()).valueOf()) {
|
||||
this.showMFADialog = true
|
||||
this.MFAConfirmed = true
|
||||
this.$axios.get(`/api/v1/assets/asset-user-auth-infos/${this.MFAInfo.asset}/`).then(res => {
|
||||
this.MFAConfirmed = true
|
||||
this.MFAInfo.hostname = res.hostname
|
||||
this.MFAInfo.password = res.password
|
||||
this.MFAInfo.username = res.username
|
||||
})
|
||||
} else {
|
||||
this.showMFADialog = true
|
||||
}
|
||||
}.bind(this)
|
||||
},
|
||||
{
|
||||
@@ -214,7 +225,7 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'publicSettings',
|
||||
'MFA_TTl',
|
||||
'MFAVerifyAt'
|
||||
]),
|
||||
needMFAVerify() {
|
||||
@@ -258,6 +269,7 @@ export default {
|
||||
}
|
||||
).then(
|
||||
res => {
|
||||
this.$store.dispatch('users/setMFAVerify')
|
||||
this.$axios.get(`/api/v1/assets/asset-user-auth-infos/${this.MFAInfo.asset}/`).then(res => {
|
||||
this.MFAConfirmed = true
|
||||
this.MFAInfo.hostname = res.hostname
|
||||
|
@@ -12,6 +12,7 @@ const getters = {
|
||||
publicSettings: state => state.settings.publicSettings,
|
||||
currentOrgRoles: state => state.users.roles,
|
||||
currentOrgPerms: state => state.users.perms,
|
||||
MFAVerifyAt: state => state.users.MFAVerifyAt
|
||||
MFAVerifyAt: state => state.users.MFAVerifyAt,
|
||||
MFA_TTl: state => state.settings.publicSettings.SECURITY_MFA_VERIFY_TTL
|
||||
}
|
||||
export default getters
|
||||
|
@@ -51,8 +51,8 @@ const mutations = {
|
||||
saveCurrentRoleToCookie(role)
|
||||
state.currentRole = role
|
||||
},
|
||||
SET_MFA_VERIFY(state, date) {
|
||||
state.MFAVerifyAt = date
|
||||
SET_MFA_VERIFY(state) {
|
||||
state.MFAVerifyAt = (new Date()).valueOf()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,8 +147,8 @@ const actions = {
|
||||
setCurrentRole({ commit }, role) {
|
||||
commit('SET_CURRENT_ROLE', role)
|
||||
},
|
||||
setMFAVerify({ commit }, date) {
|
||||
commit('SET_MFA_VERIFY', date)
|
||||
setMFAVerify({ commit }) {
|
||||
commit('SET_MFA_VERIFY')
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -26,7 +26,7 @@
|
||||
<br>
|
||||
<el-radio v-model="exportOption" class="export-item" label="2">{{ this.$t('common.imExport.ExportOnlySelectedItems') }}</el-radio>
|
||||
<br>
|
||||
<el-radio v-model="exportOption" class="export-item" label="3">{{ this.$t('common.imExport.ExportOnlyFiltered') }}</el-radio>
|
||||
<el-radio v-model="exportOption" disabled class="export-item" label="3">{{ this.$t('common.imExport.ExportOnlyFiltered') }}</el-radio>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</Dialog>
|
||||
@@ -78,6 +78,7 @@ import Dialog from '@/components/Dialog'
|
||||
import { setUrlParam } from '@/utils/common'
|
||||
import { createSourceIdCache } from '@/api/common'
|
||||
import * as queryUtil from '@/components/DataTable/compenents/el-data-table/utils/query'
|
||||
import { mapGetters } from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'Vault',
|
||||
@@ -96,6 +97,7 @@ export default {
|
||||
showExportDialog: false,
|
||||
exportOption: '1',
|
||||
meta: {},
|
||||
MfaExpired: 0,
|
||||
showMFADialog: false,
|
||||
MFAInput: '',
|
||||
selectedRows: '',
|
||||
@@ -105,15 +107,23 @@ export default {
|
||||
url: '/api/v1/assets/asset-users/',
|
||||
handleImport: function({ selectedRows }) {
|
||||
this.selectedRows = selectedRows
|
||||
this.showMFADialog = true
|
||||
this.dialogStatus = 'import'
|
||||
console.log(this.selectedRows)
|
||||
if (this.MFAVerifyAt + this.MFA_TTl * 1000 > (new Date()).valueOf()) {
|
||||
this.showMFADialog = false
|
||||
this.showImportDialog = true
|
||||
} else {
|
||||
this.showMFADialog = true
|
||||
}
|
||||
}.bind(this),
|
||||
handleExport: function({ selectedRows }) {
|
||||
this.selectedRows = selectedRows
|
||||
this.showMFADialog = true
|
||||
this.dialogStatus = 'export'
|
||||
console.log(this.selectedRows)
|
||||
if (this.MFAVerifyAt + this.MFA_TTl * 1000 > (new Date()).valueOf()) {
|
||||
this.showMFADialog = false
|
||||
this.showExportDialog = true
|
||||
} else {
|
||||
this.showMFADialog = true
|
||||
}
|
||||
}.bind(this)
|
||||
},
|
||||
treeSetting: {
|
||||
@@ -160,7 +170,11 @@ export default {
|
||||
cls.push('error-msg')
|
||||
}
|
||||
return cls
|
||||
}
|
||||
},
|
||||
...mapGetters([
|
||||
'MFAVerifyAt',
|
||||
'MFA_TTl'
|
||||
])
|
||||
},
|
||||
methods: {
|
||||
performUpdate(item) {
|
||||
@@ -290,6 +304,7 @@ export default {
|
||||
}
|
||||
).then(
|
||||
res => {
|
||||
this.$store.dispatch('users/setMFAVerify')
|
||||
if (this.dialogStatus === 'import') {
|
||||
this.showMFADialog = false
|
||||
this.showImportDialog = true
|
||||
|
Reference in New Issue
Block a user