@befly-addon/admin 1.1.1 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@befly-addon/admin",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "title": "管理后台",
5
5
  "description": "Befly - 管理后台功能组件",
6
6
  "type": "module",
@@ -43,9 +43,9 @@
43
43
  "url": "https://github.com/chenbimo/befly.git",
44
44
  "directory": "packages/addon-admin"
45
45
  },
46
- "gitHead": "19ec26ee9c8cf1f4ca6c4693176272a77a67f673",
46
+ "gitHead": "91c93d26c964f8390258a2ff770f533f2c6debfc",
47
47
  "dependencies": {
48
- "befly-shared": "^1.2.0",
48
+ "befly-shared": "^1.2.2",
49
49
  "nodemailer": "^7.0.11",
50
50
  "ua-parser-js": "^2.0.6"
51
51
  },
@@ -32,6 +32,7 @@ import ILucideUser from '~icons/lucide/user';
32
32
  import ILucideLock from '~icons/lucide/lock';
33
33
  import { $Http } from '@/plugins/http';
34
34
  import { $Storage } from '@/plugins/storage';
35
+ import { hashPassword } from 'befly-shared/hashPassword';
35
36
 
36
37
  const router = useRouter();
37
38
 
@@ -65,9 +66,12 @@ const $Method = {
65
66
 
66
67
  $Data.loading = true;
67
68
 
69
+ // 对密码进行 SHA-256 加密
70
+ const hashedPassword = await hashPassword($Data.formData.password);
71
+
68
72
  const res = await $Http('/addon/admin/auth/login', {
69
73
  account: $Data.formData.account,
70
- password: $Data.formData.password
74
+ password: hashedPassword
71
75
  });
72
76
 
73
77
  // 先保存 token
@@ -48,6 +48,7 @@ import {
48
48
  } from 'tdesign-vue-next';
49
49
  import { $Http } from '@/plugins/http';
50
50
  import { fieldClear } from 'befly-shared/fieldClear';
51
+ import { hashPassword } from 'befly-shared/hashPassword';
51
52
 
52
53
  const $Prop = defineProps({
53
54
  modelValue: {
@@ -142,6 +143,11 @@ const $Method = {
142
143
  $Data.submitting = true;
143
144
  const formData = $Prop.actionType === 'add' ? fieldClear($Data.formData, { omitKeys: ['id', 'state'] }) : fieldClear($Data.formData, { omitKeys: ['password'] });
144
145
 
146
+ // 添加管理员时,对密码进行 SHA-256 加密
147
+ if ($Prop.actionType === 'add' && formData.password) {
148
+ formData.password = await hashPassword(formData.password);
149
+ }
150
+
145
151
  const result = await $Http($Prop.actionType === 'upd' ? '/addon/admin/admin/upd' : '/addon/admin/admin/ins', formData);
146
152
 
147
153
  MessagePlugin.success(result.msg);