Compare commits

...

2 Commits

2 changed files with 93 additions and 77 deletions

View File

@@ -62,6 +62,7 @@ import Dialog from '@/components/Dialog/index.vue'
import PasswordHistoryDialog from './PasswordHistoryDialog.vue' import PasswordHistoryDialog from './PasswordHistoryDialog.vue'
import { SecretViewerFormatter } from '@/components/Table/TableFormatters' import { SecretViewerFormatter } from '@/components/Table/TableFormatters'
import { encryptPassword } from '@/utils/secure' import { encryptPassword } from '@/utils/secure'
import { mapGetters } from 'vuex'
export default { export default {
name: 'ShowSecretInfo', name: 'ShowSecretInfo',
@@ -111,6 +112,9 @@ export default {
} }
}, },
computed: { computed: {
...mapGetters({
publicSettings: 'publicSettings'
}),
secretTypeLabel() { secretTypeLabel() {
return this.account['secret_type'].label || 'Password' return this.account['secret_type'].label || 'Password'
}, },
@@ -146,7 +150,11 @@ export default {
}) })
}, },
showSecretDialog() { showSecretDialog() {
return this.$axios.get(this.url, { disableFlashErrorMsg: true }).then((res) => { if (!this.publicSettings.SECURITY_ACCOUNT_SECRET_READ) {
this.$message.warning(this.$tc('AccountSecretReadDisabled'))
return
}
return this.$axios.get(this.url).then((res) => {
this.secretInfo = res this.secretInfo = res
this.sshKeyFingerprint = res?.spec_info?.ssh_key_fingerprint || '-' this.sshKeyFingerprint = res?.spec_info?.ssh_key_fingerprint || '-'
this.showSecret = true this.showSecret = true

View File

@@ -38,6 +38,7 @@
<script> <script>
import { copy, downloadText } from '@/utils/common/index' import { copy, downloadText } from '@/utils/common/index'
import BaseFormatter from '@/components/Table/TableFormatters/base.vue' import BaseFormatter from '@/components/Table/TableFormatters/base.vue'
import { mapGetters } from 'vuex'
export default { export default {
name: 'SecretViewerFormatter', name: 'SecretViewerFormatter',
@@ -69,6 +70,9 @@ export default {
} }
}, },
computed: { computed: {
...mapGetters({
publicSettings: 'publicSettings'
}),
hasShow: function() { hasShow: function() {
return this.formatterArgs.hasShow return this.formatterArgs.hasShow
}, },
@@ -140,6 +144,10 @@ export default {
}, },
methods: { methods: {
async getAccountSecret() { async getAccountSecret() {
if (!this.publicSettings.SECURITY_ACCOUNT_SECRET_READ) {
this.$message.warning(this.$tc('AccountSecretReadDisabled'))
return
}
if (this.formatterArgs.secretFrom === 'cellValue' || this.getIt) { if (this.formatterArgs.secretFrom === 'cellValue' || this.getIt) {
return return
} }