From 56b9dcaa615ca743a85276bae94c695a85c957ea Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Mon, 18 Jul 2022 11:52:13 +0800 Subject: [PATCH] feat: add change user password support --- packages/shared/src/layouts/BasicLayout.vue | 12 +- src/modules/system/users/Login.vue | 2 +- src/modules/system/users/PasswordChange.vue | 66 +++++++++- .../system/users/ProfileModification.vue | 3 +- src/modules/system/users/UserList.vue | 54 +++++++-- ...CreationModal.vue => UserEditingModal.vue} | 33 ++--- .../components/UserPasswordChangeModal.vue | 113 ++++++++++++++++++ 7 files changed, 250 insertions(+), 33 deletions(-) rename src/modules/system/users/components/{UserCreationModal.vue => UserEditingModal.vue} (83%) create mode 100644 src/modules/system/users/components/UserPasswordChangeModal.vue diff --git a/packages/shared/src/layouts/BasicLayout.vue b/packages/shared/src/layouts/BasicLayout.vue index b3116e67..3f13f922 100644 --- a/packages/shared/src/layouts/BasicLayout.vue +++ b/packages/shared/src/layouts/BasicLayout.vue @@ -12,7 +12,7 @@ import type { MenuGroupType, MenuItemType } from "@/types/menus"; import type { User } from "../../../../src/types/extension"; import logo from "@/assets/logo.svg"; import { RouterView, useRoute, useRouter } from "vue-router"; -import { inject, ref } from "vue"; +import { computed, inject, ref } from "vue"; const menus = inject("menus"); const minimenus = inject("minimenus"); @@ -28,6 +28,14 @@ const currentUser = inject("currentUser"); const handleRouteToProfile = () => { router.push({ path: `/users/${currentUser?.metadata.name}/detail` }); }; + +const currentRole = computed(() => { + return JSON.parse( + currentUser?.metadata.annotations?.[ + "rbac.authorization.halo.run/role-names" + ] || "[]" + )[0]; +});