From 251327f8b968f339a36f2d7028dd4c1c816e22fc Mon Sep 17 00:00:00 2001 From: Bai Date: Wed, 27 May 2020 19:29:42 +0800 Subject: [PATCH 1/9] =?UTF-8?q?[Update]=20=E6=9B=B4=E6=96=B0=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=B8=AA=E4=BA=BA=E4=BF=A1=E6=81=AF=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=EF=BC=881=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/langs/cn.json | 4 +++- src/userviews/users/UserProfile.vue | 13 +++++++++++-- vue.config.js | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/i18n/langs/cn.json b/src/i18n/langs/cn.json index 3a0397279..958adb7a8 100644 --- a/src/i18n/langs/cn.json +++ b/src/i18n/langs/cn.json @@ -197,7 +197,9 @@ }, "updateErrorMsg": "更新失败", "updateSelected": "更新所选", - "updateSuccessMsg": "更新成功" + "updateSuccessMsg": "更新成功", + "Disable": "禁用", + "Enable": "启用" }, "dashboard": { "ActiveAsset": "近期被登录过", diff --git a/src/userviews/users/UserProfile.vue b/src/userviews/users/UserProfile.vue index 83b557e63..3331a7195 100644 --- a/src/userviews/users/UserProfile.vue +++ b/src/userviews/users/UserProfile.vue @@ -32,10 +32,19 @@ export default { title: this.$t('assets.SetMFA'), attrs: { type: 'primary', - label: this.$t('common.Reset') + label: this.object.mfa_enabled ? this.$t('common.Disable') : this.$t('common.Enable'), + disabled: this.object.mfa_force_enabled }, callbacks: { - click: function() {} + click: function() { + if (this.object.mfa_enabled) { + if (!this.object.mfa_force_enabled) { + window.location.href = `/users/profile/otp/disable/authentication/?next=${this.$route.fullPath}` + } + } else { + window.location.href = `/users/profile/otp/enable/start/?next=${this.$route.fullPath}` + } + }.bind(this) } }, { diff --git a/vue.config.js b/vue.config.js index ab3f37117..c597ca2b6 100644 --- a/vue.config.js +++ b/vue.config.js @@ -47,7 +47,7 @@ module.exports = { ['^' + process.env.VUE_APP_BASE_API]: '' } }, - '^/(auth|static)': { + '^/(auth|static|users/profile/otp/)': { target: `http://localhost:8080`, changeOrigin: true } From bf3f9570ca54d93bca04280d13b7388ba30d0dcc Mon Sep 17 00:00:00 2001 From: Bai Date: Wed, 27 May 2020 19:54:55 +0800 Subject: [PATCH 2/9] =?UTF-8?q?[Update]=20=E6=9B=B4=E6=96=B0=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=B8=AA=E4=BA=BA=E4=BF=A1=E6=81=AF=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=EF=BC=882=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/userviews/users/UserProfile.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/userviews/users/UserProfile.vue b/src/userviews/users/UserProfile.vue index 3331a7195..8ae88421f 100644 --- a/src/userviews/users/UserProfile.vue +++ b/src/userviews/users/UserProfile.vue @@ -51,10 +51,12 @@ export default { title: this.$t('assets.UpdateMFA'), attrs: { type: 'primary', - label: this.$t('common.Reset') + label: this.$t('common.Update') }, callbacks: { - click: function() {} + click: function() { + window.location.href = `/users/profile/otp/update/?next=${this.$route.fullPath}` + }.bind(this) } }, { From 2ee476f9045b87f6bf47bf6d865332604f2c2ff9 Mon Sep 17 00:00:00 2001 From: Bai Date: Wed, 27 May 2020 20:20:03 +0800 Subject: [PATCH 3/9] =?UTF-8?q?[Update]=20=E6=9B=B4=E6=96=B0=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=B8=AA=E4=BA=BA=E4=BF=A1=E6=81=AF=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=EF=BC=883=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/userviews/users/UserProfile.vue | 4 +++- vue.config.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/userviews/users/UserProfile.vue b/src/userviews/users/UserProfile.vue index 8ae88421f..762fd358a 100644 --- a/src/userviews/users/UserProfile.vue +++ b/src/userviews/users/UserProfile.vue @@ -88,7 +88,9 @@ export default { label: this.$t('common.Reset') }, callbacks: { - click: function() {} + click: function() { + window.open(`/users/profile/pubkey/generate/`, '_blank') + } } } ] diff --git a/vue.config.js b/vue.config.js index c597ca2b6..bee40ac2e 100644 --- a/vue.config.js +++ b/vue.config.js @@ -47,7 +47,7 @@ module.exports = { ['^' + process.env.VUE_APP_BASE_API]: '' } }, - '^/(auth|static|users/profile/otp/)': { + '^/(auth|static|dsers/profile/op/|users/profile/pubkey/generate/)': { target: `http://localhost:8080`, changeOrigin: true } From 03e9425fc8006cc91b380168d33eae4f11f6777c Mon Sep 17 00:00:00 2001 From: Bai Date: Thu, 28 May 2020 10:59:13 +0800 Subject: [PATCH 4/9] =?UTF-8?q?[Update]=20=E4=BF=AE=E6=94=B9=E4=B8=AA?= =?UTF-8?q?=E4=BA=BA=E4=BF=A1=E6=81=AF=E7=9B=AE=E5=BD=95=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/NavHeader/AccountDropdown.vue | 2 +- src/router/index.js | 4 +- .../users/UserProfile/PasswordUpdate.vue | 13 ++++++ .../ProfileInfo.vue} | 46 +++++++++---------- .../users/UserProfile/ProfileUpdate.vue | 14 ++++++ src/userviews/users/UserProfile/SSHUpdate.vue | 14 ++++++ .../users/{ => UserProfile}/index.vue | 26 +++++++++-- 7 files changed, 90 insertions(+), 29 deletions(-) create mode 100644 src/userviews/users/UserProfile/PasswordUpdate.vue rename src/userviews/users/{UserProfile.vue => UserProfile/ProfileInfo.vue} (86%) create mode 100644 src/userviews/users/UserProfile/ProfileUpdate.vue create mode 100644 src/userviews/users/UserProfile/SSHUpdate.vue rename src/userviews/users/{ => UserProfile}/index.vue (53%) diff --git a/src/layout/components/NavHeader/AccountDropdown.vue b/src/layout/components/NavHeader/AccountDropdown.vue index d8ceeeb7d..2c2f0ca04 100644 --- a/src/layout/components/NavHeader/AccountDropdown.vue +++ b/src/layout/components/NavHeader/AccountDropdown.vue @@ -54,7 +54,7 @@ export default { handleClick(val) { switch (val) { case 'profile': - this.$router.push({ name: 'userProfile' }) + this.$router.push({ name: 'UserProfile' }) break case 'AdminPage': setPermission('Admin') diff --git a/src/router/index.js b/src/router/index.js index 40356ef63..684971d69 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -65,8 +65,8 @@ export const commonRoutes = { children: [ { path: '', - name: 'userProfile', - component: () => import('@/userviews/users/index'), + name: 'UserProfile', + component: () => import('@/userviews/users/UserProfile/index'), meta: { title: i18n.t('route.UserProfile'), icon: 'user', activeMenu: '/users/profile' } } ] diff --git a/src/userviews/users/UserProfile/PasswordUpdate.vue b/src/userviews/users/UserProfile/PasswordUpdate.vue new file mode 100644 index 000000000..190400876 --- /dev/null +++ b/src/userviews/users/UserProfile/PasswordUpdate.vue @@ -0,0 +1,13 @@ + + + + + diff --git a/src/userviews/users/UserProfile.vue b/src/userviews/users/UserProfile/ProfileInfo.vue similarity index 86% rename from src/userviews/users/UserProfile.vue rename to src/userviews/users/UserProfile/ProfileInfo.vue index 762fd358a..ba2db7169 100644 --- a/src/userviews/users/UserProfile.vue +++ b/src/userviews/users/UserProfile/ProfileInfo.vue @@ -14,7 +14,7 @@ import DetailCard from '@/components/DetailCard' import QuickActions from '@/components/QuickActions' import { toSafeLocalDateStr } from '@/utils/common' export default { - name: 'UserProfile', + name: 'ProfileInfo', components: { DetailCard, QuickActions @@ -59,28 +59,28 @@ export default { }.bind(this) } }, - { - title: this.$t('assets.UpdatePassword'), - attrs: { - type: 'primary', - label: this.$t('common.Update') - }, - callbacks: { - click: function() { - - } - } - }, - { - title: this.$t('assets.UpdateSSHPublicKey'), - attrs: { - type: 'primary', - label: this.$t('common.Update') - }, - callbacks: { - click: function() {} - } - }, + // { + // title: this.$t('assets.UpdatePassword'), + // attrs: { + // type: 'primary', + // label: this.$t('common.Update') + // }, + // callbacks: { + // click: function() { + // + // } + // } + // }, + // { + // title: this.$t('assets.UpdateSSHPublicKey'), + // attrs: { + // type: 'primary', + // label: this.$t('common.Update') + // }, + // callbacks: { + // click: function() {} + // } + // }, { title: this.$t('assets.ResetPublicKeyAndDownload'), attrs: { diff --git a/src/userviews/users/UserProfile/ProfileUpdate.vue b/src/userviews/users/UserProfile/ProfileUpdate.vue new file mode 100644 index 000000000..f80a78bc4 --- /dev/null +++ b/src/userviews/users/UserProfile/ProfileUpdate.vue @@ -0,0 +1,14 @@ + + + + + diff --git a/src/userviews/users/UserProfile/SSHUpdate.vue b/src/userviews/users/UserProfile/SSHUpdate.vue new file mode 100644 index 000000000..925650693 --- /dev/null +++ b/src/userviews/users/UserProfile/SSHUpdate.vue @@ -0,0 +1,14 @@ + + + + + diff --git a/src/userviews/users/index.vue b/src/userviews/users/UserProfile/index.vue similarity index 53% rename from src/userviews/users/index.vue rename to src/userviews/users/UserProfile/index.vue index 0c71c3b2d..59d506613 100644 --- a/src/userviews/users/index.vue +++ b/src/userviews/users/UserProfile/index.vue @@ -8,22 +8,42 @@ diff --git a/src/userviews/users/UserProfile/index.vue b/src/userviews/users/UserProfile/index.vue index 59d506613..cb0ac3c7c 100644 --- a/src/userviews/users/UserProfile/index.vue +++ b/src/userviews/users/UserProfile/index.vue @@ -14,7 +14,6 @@ import PasswordUpdate from './PasswordUpdate' import SSHUpdate from './SSHUpdate' export default { - name: 'AssetListDetail', components: { GenericDetailPage, ProfileInfo, @@ -34,15 +33,15 @@ export default { name: 'ProfileInfo' }, { - title: '设置个人信息', + title: '个人信息设置', name: 'ProfileUpdate' }, { - title: '设置登录密码', + title: '登录密码设置', name: 'PasswordUpdate' }, { - title: '设置SSH公钥', + title: 'SSH公钥设置', name: 'SSHUpdate' } ], From 9c0003261ac7b9ba619cf2a9e0f5a41493ae77e8 Mon Sep 17 00:00:00 2001 From: Bai Date: Thu, 28 May 2020 15:07:17 +0800 Subject: [PATCH 6/9] =?UTF-8?q?[Update]=20=E6=9B=B4=E6=96=B0=E4=B8=AA?= =?UTF-8?q?=E4=BA=BA=E4=BF=A1=E6=81=AF=E9=A1=B5=E9=9D=A2=EF=BC=88=E4=B8=AA?= =?UTF-8?q?=E4=BA=BA=E4=BF=A1=E6=81=AF=E8=AE=BE=E7=BD=AE=EF=BC=892?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/userviews/users/UserProfile/ProfileUpdate.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/userviews/users/UserProfile/ProfileUpdate.vue b/src/userviews/users/UserProfile/ProfileUpdate.vue index c03db4708..72018cf79 100644 --- a/src/userviews/users/UserProfile/ProfileUpdate.vue +++ b/src/userviews/users/UserProfile/ProfileUpdate.vue @@ -29,7 +29,6 @@ export default { data() { return { url: `/api/v1/users/profile/`, - getMethod: () => 'put', fields: [ [this.$t('users.Account'), ['username', 'name', 'email']], [this.$t('common.Other'), ['phone', 'wechat']] @@ -45,7 +44,11 @@ export default { disabled: true } } - // successUrl: { name: 'UserProfile', params: { activeMenu: 'ProfileUpdate' }} + } + }, + methods: { + getMethod() { + return 'put' } } } From c84f8dd48c58b7c382ca6dccd694a9eaa65d6069 Mon Sep 17 00:00:00 2001 From: Bai Date: Thu, 28 May 2020 16:10:55 +0800 Subject: [PATCH 7/9] =?UTF-8?q?[Update]=20=E6=9B=B4=E6=96=B0=E4=B8=AA?= =?UTF-8?q?=E4=BA=BA=E4=BF=A1=E6=81=AF=E9=A1=B5=E9=9D=A2=EF=BC=88=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E5=AF=86=E7=A0=81=E8=AE=BE=E7=BD=AE=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../users/UserProfile/PasswordUpdate.vue | 56 ++++++++++++++++++- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/src/userviews/users/UserProfile/PasswordUpdate.vue b/src/userviews/users/UserProfile/PasswordUpdate.vue index 190400876..df412652f 100644 --- a/src/userviews/users/UserProfile/PasswordUpdate.vue +++ b/src/userviews/users/UserProfile/PasswordUpdate.vue @@ -1,10 +1,62 @@ From 0cc3bc141bf733e47b8d299a43adf817f0329f60 Mon Sep 17 00:00:00 2001 From: Bai Date: Thu, 28 May 2020 17:45:28 +0800 Subject: [PATCH 8/9] =?UTF-8?q?[Update]=20=E6=9B=B4=E6=96=B0=E4=B8=AA?= =?UTF-8?q?=E4=BA=BA=E4=BF=A1=E6=81=AF=E9=A1=B5=E9=9D=A2=EF=BC=88SSH?= =?UTF-8?q?=E5=85=AC=E9=92=A5=E8=AE=BE=E7=BD=AE=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/userviews/users/UserProfile/SSHUpdate.vue | 66 ++++++++++++++++++- 1 file changed, 63 insertions(+), 3 deletions(-) diff --git a/src/userviews/users/UserProfile/SSHUpdate.vue b/src/userviews/users/UserProfile/SSHUpdate.vue index 925650693..4bcefe678 100644 --- a/src/userviews/users/UserProfile/SSHUpdate.vue +++ b/src/userviews/users/UserProfile/SSHUpdate.vue @@ -1,11 +1,71 @@ From b01afacbec4e4fcfe2fd9b7454fe801184eb9134 Mon Sep 17 00:00:00 2001 From: Bai Date: Thu, 28 May 2020 17:46:26 +0800 Subject: [PATCH 9/9] =?UTF-8?q?[Update]=20=E6=9B=B4=E6=96=B0=E4=B8=AA?= =?UTF-8?q?=E4=BA=BA=E4=BF=A1=E6=81=AF=E9=A1=B5=E9=9D=A2=EF=BC=88SSH?= =?UTF-8?q?=E5=85=AC=E9=92=A5=E8=AE=BE=E7=BD=AE=EF=BC=892?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/userviews/users/UserProfile/SSHUpdate.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/userviews/users/UserProfile/SSHUpdate.vue b/src/userviews/users/UserProfile/SSHUpdate.vue index 4bcefe678..9fba19c2a 100644 --- a/src/userviews/users/UserProfile/SSHUpdate.vue +++ b/src/userviews/users/UserProfile/SSHUpdate.vue @@ -31,8 +31,8 @@ export default { return { url: '/api/v1/users/profile/public-key/', fields: [ - ['原来SSH密钥', ['public_key_comment', 'public_key_hash_md5']], - ['更新SSH密码', ['public_key']] + ['原来SSH公钥', ['public_key_comment', 'public_key_hash_md5']], + ['更新SSH公钥', ['public_key']] ], fieldsMeta: { public_key_comment: {