From a34a3fec38e32f68771133e1eccbeef54b066809 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=95=E9=87=91=E6=B3=BD?= <1098696801@qq.com> Date: Tue, 28 Jun 2022 21:56:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E5=A4=96=E9=93=BE=20ifram?= =?UTF-8?q?e=E6=96=B9=E5=BC=8F=20=E5=88=B7=E6=96=B0=E9=A1=B5=E9=9D=A2=20?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E7=A9=BA=E7=99=BD=E9=A1=B5=E9=9D=A2=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20=E7=99=BB=E5=BD=95=20=E5=AF=86=E7=A0=81=E5=8A=A0?= =?UTF-8?q?=E5=AF=86=E4=BC=A0=E8=BE=93=20=E8=8F=9C=E5=8D=95=E7=AE=A1?= =?UTF-8?q?=E7=90=86=20=E6=90=9C=E7=B4=A2=E4=B9=8B=E5=90=8E=20=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E4=BF=AE=E6=94=B9=20=E6=B2=A1=E6=9C=89=E6=B8=85?= =?UTF-8?q?=E9=99=A4=20font=E6=A0=87=E7=AD=BE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/magic-api/api/系统管理/安全/登录.ms | 19 +++++++++---------- magic-boot-ui/package.json | 1 + magic-boot-ui/src/scripts/auth.js | 8 +++++++- magic-boot-ui/src/scripts/routerPermission.js | 3 ++- magic-boot-ui/src/scripts/treeTable.js | 6 ++++++ .../src/views/system/menu/menu-form.vue | 2 +- .../src/views/system/office/office-list.vue | 2 +- 7 files changed, 27 insertions(+), 14 deletions(-) diff --git a/data/magic-api/api/系统管理/安全/登录.ms b/data/magic-api/api/系统管理/安全/登录.ms index 6cc1a30..1c27378 100644 --- a/data/magic-api/api/系统管理/安全/登录.ms +++ b/data/magic-api/api/系统管理/安全/登录.ms @@ -5,7 +5,7 @@ "groupId" : "1952f25c81084e24b55b11385767dc38", "name" : "登录", "createTime" : null, - "updateTime" : 1653128903331, + "updateTime" : 1656424297619, "lock" : "0", "createBy" : null, "updateBy" : null, @@ -61,13 +61,13 @@ "expression" : null, "children" : null } ], - "requestBody" : "{\r\n \"username\": \"admin\",\r\n \"password\": \"123456\"\r\n}", + "requestBody" : "{\r\n \"username\": \"admin\",\r\n \"password\": \"8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92\"\r\n}", "headers" : [ ], "paths" : [ ], - "responseBody" : "{\n \"code\": 0,\n \"message\": \"请输入验证码\",\n \"data\": null,\n \"timestamp\": 1651934108567,\n \"executeTime\": 5\n}", + "responseBody" : "{\n \"code\": 0,\n \"message\": \"用户名或密码错误\",\n \"data\": null,\n \"timestamp\": 1656424276533,\n \"executeTime\": 11\n}", "description" : null, "requestBodyDefinition" : { - "name" : "root", + "name" : "", "value" : "", "description" : "", "required" : false, @@ -91,7 +91,7 @@ "children" : [ ] }, { "name" : "password", - "value" : "123456", + "value" : "8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92", "description" : "", "required" : false, "dataType" : "String", @@ -128,7 +128,7 @@ "children" : [ ] }, { "name" : "message", - "value" : "请输入验证码", + "value" : "用户名或密码错误", "description" : "", "required" : false, "dataType" : "String", @@ -152,7 +152,7 @@ "children" : [ ] }, { "name" : "timestamp", - "value" : "1651934108567", + "value" : "1656424276533", "description" : "", "required" : false, "dataType" : "Long", @@ -164,7 +164,7 @@ "children" : [ ] }, { "name" : "executeTime", - "value" : "5", + "value" : "11", "description" : "", "required" : false, "dataType" : "Integer", @@ -180,7 +180,6 @@ ================================ import org.ssssssss.magicboot.utils.AddressUtil import log -import 'cn.dev33.satoken.secure.SaSecureUtil'; import 'cn.dev33.satoken.stp.StpUtil'; import '@/configure/getBykey' as configure; import request; @@ -201,7 +200,7 @@ var user if(configure('super-password') == body.password){ user = db.table("sys_user").where().eq("username",body.username).selectOne() }else{ - user = db.table("sys_user").where().eq("username",body.username).eq("password",SaSecureUtil.sha256(body.password)).selectOne() + user = db.table("sys_user").where().eq("username",body.username).eq("password", body.password).selectOne() } var loginLog = { diff --git a/magic-boot-ui/package.json b/magic-boot-ui/package.json index a9f9ec7..0dea371 100644 --- a/magic-boot-ui/package.json +++ b/magic-boot-ui/package.json @@ -11,6 +11,7 @@ "dependencies": { "axios": "^0.24.0", "element-plus": "^2.2.6", + "js-sha256": "^0.9.0", "nprogress": "0.2.0", "path-browserify": "^1.0.1", "vue": "^3.2.25", diff --git a/magic-boot-ui/src/scripts/auth.js b/magic-boot-ui/src/scripts/auth.js index f6b0953..675686b 100644 --- a/magic-boot-ui/src/scripts/auth.js +++ b/magic-boot-ui/src/scripts/auth.js @@ -1,5 +1,7 @@ import global from './global' import request from '@/scripts/request' +import { sha256 } from 'js-sha256' + const TokenKey = 'magic_boot_token' export function getToken() { @@ -41,7 +43,11 @@ export function login(data){ request({ url: '/system/security/login', method: 'post', - data + data: { + username: data.username, + password: sha256(data.password), + code: data.code + } }).then(res => { var token = res.data setToken(token) diff --git a/magic-boot-ui/src/scripts/routerPermission.js b/magic-boot-ui/src/scripts/routerPermission.js index c1de86d..523151f 100644 --- a/magic-boot-ui/src/scripts/routerPermission.js +++ b/magic-boot-ui/src/scripts/routerPermission.js @@ -1,5 +1,6 @@ import request from '@/scripts/request' import common from '@/scripts/common' +import { sha256 } from 'js-sha256' const viewModules = import.meta.glob("../views/**/**.vue") const layoutModules = import.meta.glob("../layout/**.vue") @@ -11,7 +12,7 @@ export const filterAsyncRouter = (routers, level) => { var setIframe = () => { router.component = loadView(`/common/iframe`) router.props = { url: router.url } - router.path = "/" + common.uuid() + router.path = "/" + sha256(router.url) } if(router.url.startsWith('http')){ if(router.openMode == '0'){ diff --git a/magic-boot-ui/src/scripts/treeTable.js b/magic-boot-ui/src/scripts/treeTable.js index 20defe0..b37f603 100644 --- a/magic-boot-ui/src/scripts/treeTable.js +++ b/magic-boot-ui/src/scripts/treeTable.js @@ -93,4 +93,10 @@ treeTable.treeNodeReplace = (fields, searchData, treeNode, text, childrenSearch, } } +treeTable.clearFont = (data, fields) => { + fields.forEach(field => { + data[field] = data[field].replaceAll(/(.*?)<\/font>/g,'$1') + }) +} + export default treeTable diff --git a/magic-boot-ui/src/views/system/menu/menu-form.vue b/magic-boot-ui/src/views/system/menu/menu-form.vue index 1aa5f0b..04de513 100644 --- a/magic-boot-ui/src/views/system/menu/menu-form.vue +++ b/magic-boot-ui/src/views/system/menu/menu-form.vue @@ -242,7 +242,7 @@ function getInfo(row) { } openModeRef.value = temp.value.openMode || '0' menuType.value = temp.value.url ? 'menu' : 'button' - temp.value.name = temp.value.name.replaceAll(/(.*?)<\/font>/g,'$1') + proxy.$treeTable.clearFont(temp.value, ['name', 'url', 'permission']) nextTick(() => { dataForm.value.clearValidate() }) diff --git a/magic-boot-ui/src/views/system/office/office-list.vue b/magic-boot-ui/src/views/system/office/office-list.vue index 1a300a8..b419e13 100644 --- a/magic-boot-ui/src/views/system/office/office-list.vue +++ b/magic-boot-ui/src/views/system/office/office-list.vue @@ -336,7 +336,7 @@ function handleUpdate(row) { for (var t in temp.value) { temp.value[t] = row[t] } - temp.value.name = temp.value.name.replaceAll(/(.*?)<\/font>/g,'$1') + proxy.$treeTable.clearFont(temp.value, ['name', 'code']) dialogTitle.value = '修改' officeFormDialog.value.show() nextTick(() => {