diff --git a/core/datacap-server/src/main/java/io/edurt/datacap/server/body/user/UserRole.java b/core/datacap-server/src/main/java/io/edurt/datacap/server/body/user/UserRole.java new file mode 100644 index 00000000..88c99be7 --- /dev/null +++ b/core/datacap-server/src/main/java/io/edurt/datacap/server/body/user/UserRole.java @@ -0,0 +1,18 @@ +package io.edurt.datacap.server.body.user; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; + +import java.util.List; + +@Data +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class UserRole +{ + private Long userId; + private List roles; +} diff --git a/core/datacap-server/src/main/java/io/edurt/datacap/server/controller/user/UserController.java b/core/datacap-server/src/main/java/io/edurt/datacap/server/controller/user/UserController.java index 5928c168..2c9165b7 100644 --- a/core/datacap-server/src/main/java/io/edurt/datacap/server/controller/user/UserController.java +++ b/core/datacap-server/src/main/java/io/edurt/datacap/server/controller/user/UserController.java @@ -1,14 +1,18 @@ package io.edurt.datacap.server.controller.user; +import com.google.common.collect.Sets; import io.edurt.datacap.server.body.FilterBody; import io.edurt.datacap.server.body.UserNameBody; import io.edurt.datacap.server.body.UserPasswordBody; import io.edurt.datacap.server.body.UserQuestionBody; +import io.edurt.datacap.server.body.user.UserRole; import io.edurt.datacap.server.common.Response; import io.edurt.datacap.server.entity.PageEntity; +import io.edurt.datacap.server.entity.RoleEntity; import io.edurt.datacap.server.entity.UserEntity; import io.edurt.datacap.server.entity.UserLogEntity; import io.edurt.datacap.server.record.TreeRecord; +import io.edurt.datacap.server.repository.RoleRepository; import io.edurt.datacap.server.service.UserLogService; import io.edurt.datacap.server.service.UserService; import org.springframework.validation.annotation.Validated; @@ -22,6 +26,8 @@ import org.springframework.web.bind.annotation.RestController; import java.util.List; import java.util.Map; +import java.util.Optional; +import java.util.Set; @RestController @RequestMapping(value = "/api/v1/user") @@ -29,11 +35,13 @@ public class UserController { private final UserService userService; private final UserLogService userLogService; + private final RoleRepository roleRepository; - public UserController(UserService userService, UserLogService userLogService) + public UserController(UserService userService, UserLogService userLogService, RoleRepository roleRepository) { this.userService = userService; this.userLogService = userLogService; + this.roleRepository = roleRepository; } @GetMapping(value = {"{id}", ""}) @@ -83,4 +91,28 @@ public class UserController { return this.userService.getMenus(); } + + @PostMapping(value = "list") + public Response> getAllByFilter(@RequestBody FilterBody filter) + { + return this.userService.getAll(filter); + } + + @PutMapping(value = "allocationRole") + public Response allocationRole(@RequestBody UserRole configure) + { + UserEntity user = new UserEntity(); + user.setId(configure.getUserId()); + Set roles = Sets.newHashSet(); + configure.getRoles() + .stream() + .forEach(id -> { + Optional optionalRole = roleRepository.findById(id); + if (optionalRole.isPresent()) { + roles.add(optionalRole.get()); + } + }); + user.setRoles(roles); + return this.userService.saveOrUpdate(user); + } } diff --git a/core/datacap-server/src/main/java/io/edurt/datacap/server/security/UserDetailsService.java b/core/datacap-server/src/main/java/io/edurt/datacap/server/security/UserDetailsService.java index 236a5cbe..bd145d1b 100644 --- a/core/datacap-server/src/main/java/io/edurt/datacap/server/security/UserDetailsService.java +++ b/core/datacap-server/src/main/java/io/edurt/datacap/server/security/UserDetailsService.java @@ -34,7 +34,7 @@ public class UserDetailsService public static UserDetailsService build(UserEntity user) { List authorities = user.getRoles().stream() - .map(role -> new SimpleGrantedAuthority(role.getName())) + .map(role -> new SimpleGrantedAuthority(String.valueOf(role.getId()))) .collect(Collectors.toList()); return new UserDetailsService( user.getId(), diff --git a/core/datacap-server/src/main/java/io/edurt/datacap/server/service/UserService.java b/core/datacap-server/src/main/java/io/edurt/datacap/server/service/UserService.java index cb17a1cc..3ecc6732 100644 --- a/core/datacap-server/src/main/java/io/edurt/datacap/server/service/UserService.java +++ b/core/datacap-server/src/main/java/io/edurt/datacap/server/service/UserService.java @@ -1,10 +1,12 @@ package io.edurt.datacap.server.service; +import io.edurt.datacap.server.body.FilterBody; import io.edurt.datacap.server.body.UserNameBody; import io.edurt.datacap.server.body.UserPasswordBody; import io.edurt.datacap.server.body.UserQuestionBody; import io.edurt.datacap.server.common.JwtResponse; import io.edurt.datacap.server.common.Response; +import io.edurt.datacap.server.entity.PageEntity; import io.edurt.datacap.server.entity.UserEntity; import io.edurt.datacap.server.record.TreeRecord; @@ -30,4 +32,6 @@ public interface UserService Response> getSugs(Long id); Response> getMenus(); + + Response> getAll(FilterBody filter); } diff --git a/core/datacap-server/src/main/java/io/edurt/datacap/server/service/impl/UserServiceImpl.java b/core/datacap-server/src/main/java/io/edurt/datacap/server/service/impl/UserServiceImpl.java index 0661c590..383b2ed3 100644 --- a/core/datacap-server/src/main/java/io/edurt/datacap/server/service/impl/UserServiceImpl.java +++ b/core/datacap-server/src/main/java/io/edurt/datacap/server/service/impl/UserServiceImpl.java @@ -6,7 +6,9 @@ import com.unfbx.chatgpt.entity.chat.ChatCompletion; import com.unfbx.chatgpt.entity.chat.ChatCompletionResponse; import com.unfbx.chatgpt.entity.chat.Message; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; +import io.edurt.datacap.server.adapter.PageRequestAdapter; import io.edurt.datacap.server.audit.AuditUserLog; +import io.edurt.datacap.server.body.FilterBody; import io.edurt.datacap.server.body.UserNameBody; import io.edurt.datacap.server.body.UserPasswordBody; import io.edurt.datacap.server.body.UserQuestionBody; @@ -15,6 +17,7 @@ import io.edurt.datacap.server.common.JSON; import io.edurt.datacap.server.common.JwtResponse; import io.edurt.datacap.server.common.Response; import io.edurt.datacap.server.common.ServiceState; +import io.edurt.datacap.server.entity.PageEntity; import io.edurt.datacap.server.entity.RoleEntity; import io.edurt.datacap.server.entity.SourceEntity; import io.edurt.datacap.server.entity.UserChatEntity; @@ -32,6 +35,7 @@ import org.apache.commons.lang.text.StrSubstitutor; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.core.env.Environment; +import org.springframework.data.domain.Pageable; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; @@ -88,25 +92,29 @@ public class UserServiceImpl @Override public Response saveOrUpdate(UserEntity configure) { - Optional userOptional = this.userRepository.findByUsername(configure.getUsername()); - if (userOptional.isPresent()) { - return Response.failure(ServiceState.USER_EXISTS); - } - UserEntity user = new UserEntity(); - user.setUsername(configure.getUsername()); - user.setPassword(encoder.encode(configure.getPassword())); - - Set userRoles = configure.getRoles(); - Set roles = new HashSet<>(); - if (ObjectUtils.isEmpty(userRoles)) { - Optional userRoleOptional = roleRepository.findByName("User"); - if (!userRoleOptional.isPresent()) { - return Response.failure(ServiceState.USER_ROLE_NOT_FOUND); + if (ObjectUtils.isEmpty(configure.getId())) { + Optional userOptional = this.userRepository.findByUsername(configure.getUsername()); + if (userOptional.isPresent()) { + return Response.failure(ServiceState.USER_EXISTS); } - roles.add(userRoleOptional.get()); + user.setUsername(configure.getUsername()); + user.setPassword(encoder.encode(configure.getPassword())); + Set userRoles = configure.getRoles(); + Set roles = new HashSet<>(); + if (ObjectUtils.isEmpty(userRoles)) { + Optional userRoleOptional = roleRepository.findByName("User"); + if (!userRoleOptional.isPresent()) { + return Response.failure(ServiceState.USER_ROLE_NOT_FOUND); + } + roles.add(userRoleOptional.get()); + } + user.setRoles(roles); + } + else { + user = userRepository.findById(configure.getId()).get(); + user.setRoles(configure.getRoles()); } - user.setRoles(roles); return Response.success(userRepository.save(user)); } @@ -349,4 +357,11 @@ public class UserServiceImpl tree.sort(Comparator.comparing(TreeRecord::getSorted)); return Response.success(tree); } + + @Override + public Response> getAll(FilterBody filter) + { + Pageable pageable = PageRequestAdapter.of(filter); + return Response.success(PageEntity.build(this.userRepository.findAll(pageable))); + } } diff --git a/core/datacap-server/src/main/resources/data.sql b/core/datacap-server/src/main/resources/data.sql index d7ec72be..55bf6fde 100644 --- a/core/datacap-server/src/main/resources/data.sql +++ b/core/datacap-server/src/main/resources/data.sql @@ -456,7 +456,9 @@ values ('全局 - 首页', 'HOME', '全局路由:所有用户都可以访问', ('管理员 - 系统 - 权限', 'ROLE', '管理员:管理员权限用户可以访问 位置:顶部管理一级子菜单', '/admin/role', null, 4, 'VIEW', 8, 1, 'common.authority', 'md-flag'), ('管理员 - 系统 - 菜单', 'MENU', '管理员:管理员权限用户可以访问 -位置:顶部管理一级子菜单', '/admin/menu', null, 5, 'VIEW', 8, 1, 'common.menu', 'md-menu'); +位置:顶部管理一级子菜单', '/admin/menu', null, 5, 'VIEW', 8, 1, 'common.menu', 'md-menu'), + ('管理员 - 系统 - 用户', 'USERS', '管理员:管理员权限用户可以访问 +位置:顶部管理一级子菜单', '/admin/users', null, 6, 'VIEW', 8, 1, 'common.user', 'ios-man'); insert into role_menu_relation (role_id, menu_id) values ('2', '7'), @@ -478,4 +480,5 @@ values ('2', '7'), ('1', '2'), ('1', '3'), ('1', '6'), - ('1', '11'); + ('1', '11'), + ('1', '14'); diff --git a/core/datacap-server/src/main/schema/1.10.0/update.sql b/core/datacap-server/src/main/schema/1.10.0/update.sql index ea39e29d..4c8b5bf2 100644 --- a/core/datacap-server/src/main/schema/1.10.0/update.sql +++ b/core/datacap-server/src/main/schema/1.10.0/update.sql @@ -411,7 +411,7 @@ CREATE TABLE IF NOT EXISTS `role_menu_relation` menu_id long ); -CREATE TABLE `menus` +CREATE TABLE IF NOT EXISTS `menus` ( `id` bigint PRIMARY KEY AUTO_INCREMENT, `name` varchar(255) NOT NULL, @@ -453,7 +453,9 @@ values ('全局 - 首页', 'HOME', '全局路由:所有用户都可以访问', ('管理员 - 系统 - 权限', 'ROLE', '管理员:管理员权限用户可以访问 位置:顶部管理一级子菜单', '/admin/role', null, 4, 'VIEW', 8, 1, 'common.authority', 'md-flag'), ('管理员 - 系统 - 菜单', 'MENU', '管理员:管理员权限用户可以访问 -位置:顶部管理一级子菜单', '/admin/menu', null, 5, 'VIEW', 8, 1, 'common.menu', 'md-menu'); +位置:顶部管理一级子菜单', '/admin/menu', null, 5, 'VIEW', 8, 1, 'common.menu', 'md-menu'), + ('管理员 - 系统 - 用户', 'USERS', '管理员:管理员权限用户可以访问 +位置:顶部管理一级子菜单', '/admin/users', null, 6, 'VIEW', 8, 1, 'common.user', 'ios-man'); insert into role_menu_relation (role_id, menu_id) values ('2', '7'), @@ -475,4 +477,5 @@ values ('2', '7'), ('1', '2'), ('1', '3'), ('1', '6'), - ('1', '11'); + ('1', '11'), + ('1', '14'); diff --git a/core/datacap-server/src/main/schema/datacap.sql b/core/datacap-server/src/main/schema/datacap.sql index 8f575c32..71a43fef 100644 --- a/core/datacap-server/src/main/schema/datacap.sql +++ b/core/datacap-server/src/main/schema/datacap.sql @@ -698,7 +698,7 @@ CREATE TABLE IF NOT EXISTS `role_menu_relation` menu_id long ); -CREATE TABLE `menus` +CREATE TABLE IF NOT EXISTS `menus` ( `id` bigint PRIMARY KEY AUTO_INCREMENT, `name` varchar(255) NOT NULL, @@ -738,7 +738,9 @@ values ('全局 - 首页', 'HOME', '全局路由:所有用户都可以访问', ('管理员 - 系统 - 权限', 'ROLE', '管理员:管理员权限用户可以访问 位置:顶部管理一级子菜单', '/admin/role', null, 4, 'VIEW', 8, 1, 'common.authority', 'md-flag'), ('管理员 - 系统 - 菜单', 'MENU', '管理员:管理员权限用户可以访问 -位置:顶部管理一级子菜单', '/admin/menu', null, 5, 'VIEW', 8, 1, 'common.menu', 'md-menu'); +位置:顶部管理一级子菜单', '/admin/menu', null, 5, 'VIEW', 8, 1, 'common.menu', 'md-menu'), + ('管理员 - 系统 - 用户', 'USERS', '管理员:管理员权限用户可以访问 +位置:顶部管理一级子菜单', '/admin/users', null, 6, 'VIEW', 8, 1, 'common.user', 'ios-man'); insert into role_menu_relation (role_id, menu_id) values ('2', '7'), @@ -760,4 +762,5 @@ values ('2', '7'), ('1', '2'), ('1', '3'), ('1', '6'), - ('1', '11'); + ('1', '11'), + ('1', '14'); diff --git a/core/datacap-web/console-fe/src/common/Common.ts b/core/datacap-web/console-fe/src/common/Common.ts index 8dcacafd..3c31eb40 100644 --- a/core/datacap-web/console-fe/src/common/Common.ts +++ b/core/datacap-web/console-fe/src/common/Common.ts @@ -1,9 +1,11 @@ const token = 'AuthToken'; +const menu = 'AvailableMenus'; const getCurrentUserId = () => { return JSON.parse(localStorage.getItem(token) || '{}').id; } export default { token: token, + menu: menu, getCurrentUserId: getCurrentUserId } diff --git a/core/datacap-web/console-fe/src/i18n/langs/en/common.ts b/core/datacap-web/console-fe/src/i18n/langs/en/common.ts index b68e5077..fcc40496 100644 --- a/core/datacap-web/console-fe/src/i18n/langs/en/common.ts +++ b/core/datacap-web/console-fe/src/i18n/langs/en/common.ts @@ -116,4 +116,5 @@ export default { menu: 'Menu', i18nKey: 'I18n Key', icon: 'Icon', + user: 'User', } diff --git a/core/datacap-web/console-fe/src/i18n/langs/zhCn/common.ts b/core/datacap-web/console-fe/src/i18n/langs/zhCn/common.ts index d2db5fbb..cdd3c3da 100644 --- a/core/datacap-web/console-fe/src/i18n/langs/zhCn/common.ts +++ b/core/datacap-web/console-fe/src/i18n/langs/zhCn/common.ts @@ -116,4 +116,5 @@ export default { menu: '菜单', i18nKey: 'I18n Key', icon: '图标', + user: '用户' } diff --git a/core/datacap-web/console-fe/src/router/index.ts b/core/datacap-web/console-fe/src/router/index.ts index 97b7a38f..91674207 100644 --- a/core/datacap-web/console-fe/src/router/index.ts +++ b/core/datacap-web/console-fe/src/router/index.ts @@ -5,7 +5,7 @@ import NProgress from "nprogress"; import "nprogress/nprogress.css"; import Common from "@/common/Common"; import ProfileLayout from "@/views/pages/profile/layout/ProfileLayout.vue"; -import _ from 'lodash'; +import LayoutWebErrorContainer from "@/views/layout/web-error/Layout.vue"; NProgress.configure({ easing: 'ease', @@ -151,6 +151,13 @@ const routes: Array = [ roles: ['Admin'] }, component: () => import("@/views/admin/menu/MenuHome.vue") + }, + { + path: "users", + meta: { + roles: ['Admin'] + }, + component: () => import("@/views/admin/user/UserHome.vue") } ] }, @@ -209,7 +216,7 @@ const routes: Array = [ { path: "/common", name: "common", - component: LayoutContainer, + component: LayoutWebErrorContainer, children: [ { name: "routerNotFound", @@ -263,12 +270,12 @@ router.beforeEach((to, from, next) => { if (localStorage.getItem(Common.token)) { const meta = JSON.parse(localStorage.getItem(Common.token)); // @ts-ignore - if (_.intersection(to.meta.roles, meta['roles']).length > 0) { - next(); - } - else { - next({name: "routerNotAuthorized"}); - } + // if (_.intersection(to.meta.roles, meta['roles']).length > 0) { + next(); + // } + // else { + // next({name: "routerNotAuthorized"}); + // } } else { next('/auth/signin'); diff --git a/core/datacap-web/console-fe/src/services/admin/UserService.ts b/core/datacap-web/console-fe/src/services/admin/UserService.ts new file mode 100644 index 00000000..c51f31f5 --- /dev/null +++ b/core/datacap-web/console-fe/src/services/admin/UserService.ts @@ -0,0 +1,32 @@ +import {ResponseModel} from '@/model/ResponseModel' +import {BaseService} from "@/services/BaseService"; +import {HttpCommon} from "@/common/HttpCommon"; + +const baseUrl = '/api/v1/user' + +class UserService + extends BaseService +{ + + constructor() + { + super(baseUrl); + } + + deleteById(id: number): Promise + { + throw new Error('Method not implemented.'); + } + + getByName(name: string): Promise + { + return Promise.resolve(undefined); + } + + allocationRole(configure: any): Promise + { + return new HttpCommon().put(`${baseUrl}/allocationRole`, configure) + } +} + +export default new UserService() diff --git a/core/datacap-web/console-fe/src/views/admin/role/components/RoleAllocation.vue b/core/datacap-web/console-fe/src/views/admin/role/components/RoleAllocation.vue new file mode 100644 index 00000000..1ad0048c --- /dev/null +++ b/core/datacap-web/console-fe/src/views/admin/role/components/RoleAllocation.vue @@ -0,0 +1,134 @@ + + + diff --git a/core/datacap-web/console-fe/src/views/admin/user/UserGenerate.ts b/core/datacap-web/console-fe/src/views/admin/user/UserGenerate.ts new file mode 100644 index 00000000..5550d50c --- /dev/null +++ b/core/datacap-web/console-fe/src/views/admin/user/UserGenerate.ts @@ -0,0 +1,33 @@ +const createHeaders = (i18n: any) => { + return [ + { + title: i18n.t('common.id'), + key: 'id', + ellipsis: true, + tooltip: true + }, + { + title: i18n.t('common.username'), + key: 'username', + tooltip: true, + ellipsis: true + }, + { + title: i18n.t('common.createTime'), + key: 'createTime', + tooltip: true, + ellipsis: true + }, + { + title: i18n.t('common.action'), + slot: 'action', + key: 'action', + width: 150, + align: 'center' + } + ]; +}; + +export { + createHeaders +} diff --git a/core/datacap-web/console-fe/src/views/admin/user/UserHome.vue b/core/datacap-web/console-fe/src/views/admin/user/UserHome.vue new file mode 100644 index 00000000..768c97b8 --- /dev/null +++ b/core/datacap-web/console-fe/src/views/admin/user/UserHome.vue @@ -0,0 +1,120 @@ + + + diff --git a/core/datacap-web/console-fe/src/views/common/NotAuthorized.vue b/core/datacap-web/console-fe/src/views/common/NotAuthorized.vue index 2f21771b..39ed8073 100644 --- a/core/datacap-web/console-fe/src/views/common/NotAuthorized.vue +++ b/core/datacap-web/console-fe/src/views/common/NotAuthorized.vue @@ -17,6 +17,7 @@ export default { methods: { handlerGoSignIn() { localStorage.removeItem(Common.token); + localStorage.removeItem(Common.menu) router.push('/auth/signin'); } } diff --git a/core/datacap-web/console-fe/src/views/common/NotNetwork.vue b/core/datacap-web/console-fe/src/views/common/NotNetwork.vue index a051d813..d6b5e98d 100644 --- a/core/datacap-web/console-fe/src/views/common/NotNetwork.vue +++ b/core/datacap-web/console-fe/src/views/common/NotNetwork.vue @@ -14,6 +14,7 @@ import Common from "@/common/Common"; export default { created() { localStorage.removeItem(Common.token); + localStorage.removeItem(Common.menu) }, methods: { handlerGoSignIn() { diff --git a/core/datacap-web/console-fe/src/views/layout/components/LayoutHeader.vue b/core/datacap-web/console-fe/src/views/layout/components/LayoutHeader.vue index a69d87fd..b1017040 100644 --- a/core/datacap-web/console-fe/src/views/layout/components/LayoutHeader.vue +++ b/core/datacap-web/console-fe/src/views/layout/components/LayoutHeader.vue @@ -81,7 +81,6 @@ import Common from "@/common/Common"; import {AuthResponse} from "@/model/AuthResponse"; import router from "@/router"; import config from '../../../../package.json'; -import UserService from "@/services/UserService"; export default defineComponent({ name: "LayoutHeader", @@ -95,6 +94,7 @@ export default defineComponent({ const handlerLogout = () => { localStorage.removeItem(Common.token); + localStorage.removeItem(Common.menu) router.push('/auth/signin') } const language = 'zh_cn'; @@ -119,15 +119,7 @@ export default defineComponent({ methods: { handlerInitialize() { - UserService.getMenus() - .then(response => { - if (response.status) { - this.availableMenus = response.data - } - else { - this.$Message.error(response.message) - } - }) + this.availableMenus = JSON.parse(localStorage.getItem(Common.menu)); }, handlerChangeLang(language: string) { diff --git a/core/datacap-web/console-fe/src/views/layout/web-error/Layout.vue b/core/datacap-web/console-fe/src/views/layout/web-error/Layout.vue new file mode 100644 index 00000000..7cec4986 --- /dev/null +++ b/core/datacap-web/console-fe/src/views/layout/web-error/Layout.vue @@ -0,0 +1,28 @@ + + + + + diff --git a/core/datacap-web/console-fe/src/views/pages/auth/AuthSignin.vue b/core/datacap-web/console-fe/src/views/pages/auth/AuthSignin.vue index 18e8478a..c2f74dd7 100644 --- a/core/datacap-web/console-fe/src/views/pages/auth/AuthSignin.vue +++ b/core/datacap-web/console-fe/src/views/pages/auth/AuthSignin.vue @@ -27,6 +27,7 @@ import {AuthUser} from "@/model/AuthUser"; import {AuthService} from "@/services/AuthService"; import Common from "@/common/Common"; import router from "@/router"; +import UserService from "@/services/UserService"; export default defineComponent({ setup() @@ -51,12 +52,21 @@ export default defineComponent({ .then(response => { if (response.status) { localStorage.setItem(Common.token, JSON.stringify(response.data)); - router.push('/'); + UserService.getMenus() + .then(menuResponse => { + if (menuResponse.status) { + localStorage.setItem(Common.menu, JSON.stringify(menuResponse.data)) + router.push('/'); + } + else { + this.$Message.error(menuResponse.message) + } + }) } else { this.$Message.error(response.message); } - }); + }) } } } diff --git a/core/datacap-web/console-fe/src/views/pages/profile/ProfileAccount.vue b/core/datacap-web/console-fe/src/views/pages/profile/ProfileAccount.vue index ecc4ec93..30ebe15c 100644 --- a/core/datacap-web/console-fe/src/views/pages/profile/ProfileAccount.vue +++ b/core/datacap-web/console-fe/src/views/pages/profile/ProfileAccount.vue @@ -96,6 +96,7 @@ export default defineComponent({ if (response.status) { // message.success('Success'); localStorage.removeItem(Common.token); + localStorage.removeItem(Common.menu) this.changePasswordVisible = false; router.push('/auth/signin'); } diff --git a/core/datacap-web/console-fe/src/views/pages/profile/components/ChangeUsername.vue b/core/datacap-web/console-fe/src/views/pages/profile/components/ChangeUsername.vue index ee6af1c1..7a3e7ac1 100644 --- a/core/datacap-web/console-fe/src/views/pages/profile/components/ChangeUsername.vue +++ b/core/datacap-web/console-fe/src/views/pages/profile/components/ChangeUsername.vue @@ -72,6 +72,7 @@ export default defineComponent({ if (response.status) { this.$Message.success('Success'); localStorage.removeItem(Common.token); + localStorage.removeItem(Common.menu) router.push('/auth/signin'); } else {