diff --git a/src/i18n/langs/cn.json b/src/i18n/langs/cn.json index 0227bdb36..3a0397279 100644 --- a/src/i18n/langs/cn.json +++ b/src/i18n/langs/cn.json @@ -69,6 +69,7 @@ "Role": "角色", "SerialNumber": "序列号", "SetMFA": "设置多因子认证", + "UpdateMFA": "更改多因子认证", "Source": "来源", "SystemUserDetail": "系统用户详情", "SystemUsers": "系统用户", diff --git a/src/layout/components/NavHeader/AccountDropdown.vue b/src/layout/components/NavHeader/AccountDropdown.vue index 7e7754e88..d8ceeeb7d 100644 --- a/src/layout/components/NavHeader/AccountDropdown.vue +++ b/src/layout/components/NavHeader/AccountDropdown.vue @@ -53,6 +53,9 @@ export default { methods: { handleClick(val) { switch (val) { + case 'profile': + this.$router.push({ name: 'userProfile' }) + break case 'AdminPage': setPermission('Admin') window.location.href = `/` diff --git a/src/router/index.js b/src/router/index.js index 2f8e5e248..40356ef63 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -54,7 +54,31 @@ export const constantRoutes = [ } ] +/** + * admin and user routes + * the routes that need to be dynamically loaded based on admin or user roles + */ +export const commonRoutes = { + userProfile: { + path: '/users/profile', + component: Layout, + children: [ + { + path: '', + name: 'userProfile', + component: () => import('@/userviews/users/index'), + meta: { title: i18n.t('route.UserProfile'), icon: 'user', activeMenu: '/users/profile' } + } + ] + } +} + +/** + * admin + * the routes that need to be dynamically loaded based on admin roles + */ export const adminRoutes = [ + Object.assign({}, commonRoutes.userProfile, { hidden: true }), { path: '/', component: Layout, @@ -187,18 +211,7 @@ export const userRoutes = [ } ] }, - { - path: '/users', - component: Layout, - children: [ - { - path: '/users/profile', - name: 'profile', - component: () => import('@/userviews/users/index'), - meta: { title: i18n.t('route.UserProfile'), icon: 'user' } - } - ] - }, + commonRoutes.userProfile, { path: '/command-executions', component: Layout, diff --git a/src/userviews/users/Detail.vue b/src/userviews/users/UserProfile.vue similarity index 92% rename from src/userviews/users/Detail.vue rename to src/userviews/users/UserProfile.vue index 62d49f1dd..83b557e63 100644 --- a/src/userviews/users/Detail.vue +++ b/src/userviews/users/UserProfile.vue @@ -14,7 +14,7 @@ import DetailCard from '@/components/DetailCard' import QuickActions from '@/components/QuickActions' import { toSafeLocalDateStr } from '@/utils/common' export default { - name: 'Detail', + name: 'UserProfile', components: { DetailCard, QuickActions @@ -38,6 +38,16 @@ export default { click: function() {} } }, + { + title: this.$t('assets.UpdateMFA'), + attrs: { + type: 'primary', + label: this.$t('common.Reset') + }, + callbacks: { + click: function() {} + } + }, { title: this.$t('assets.UpdatePassword'), attrs: { diff --git a/src/userviews/users/index.vue b/src/userviews/users/index.vue index 0fef748c9..0c71c3b2d 100644 --- a/src/userviews/users/index.vue +++ b/src/userviews/users/index.vue @@ -1,37 +1,36 @@