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