ResetMFA.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <template>
  2. <base-dialog @cancel="cancelDialog">
  3. <div slot="header">{{action}}</div>
  4. <div slot="body">
  5. <a-alert :message="$t('iam.reset_mfa_tips')" type="warning" class="mb-2" />
  6. <dialog-selected-tips :name="$t('dictionary.user')" :count="params.data.length" :action="action" />
  7. <dialog-table :data="params.data" :columns="params.columns.slice(0, 3)" />
  8. </div>
  9. <div slot="footer">
  10. <a-button type="primary" @click="handleConfirm" :loading="loading">{{ $t('dialog.ok') }}</a-button>
  11. <a-button @click="cancelDialog">{{ $t('dialog.cancel') }}</a-button>
  12. </div>
  13. </base-dialog>
  14. </template>
  15. <script>
  16. import DialogMixin from '@/mixins/dialog'
  17. import WindowsMixin from '@/mixins/windows'
  18. export default {
  19. name: 'ResetMFADialog',
  20. mixins: [DialogMixin, WindowsMixin],
  21. data () {
  22. return {
  23. action: `${this.$t('common.reset')}MFA`,
  24. loading: false,
  25. }
  26. },
  27. methods: {
  28. async handleConfirm () {
  29. this.loading = true
  30. const { data, onManager } = this.params
  31. try {
  32. onManager('performAction', {
  33. id: data[0].id,
  34. // steadyStatus: ['running', 'ready'],
  35. managerArgs: {
  36. action: 'reset-credentials',
  37. data: {
  38. type: 'totp',
  39. },
  40. },
  41. })
  42. this.$message.success(this.$t('common.success'))
  43. this.cancelDialog()
  44. } catch (error) {
  45. this.loading = false
  46. throw error
  47. }
  48. },
  49. },
  50. }
  51. </script>