Skip to content

Commit 9b56ce8

Browse files
zuohuaijungitee-org
authored andcommitted
!1040 SM公钥改成环境变量
Merge pull request !1040 from KaneLeung/next
2 parents d1fa2fc + b100e0c commit 9b56ce8

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

Web/.env

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@ VITE_OPEN = false
88
VITE_OPEN_CDN = false
99

1010
# public path 配置线上环境路径(打包)、本地通过 http-server 访问时,请置空即可
11-
VITE_PUBLIC_PATH =
11+
VITE_PUBLIC_PATH =
12+
13+
# SM公钥
14+
VITE_SM_PUBLIC_KEY = "0484C7466D950E120E5ECE5DD85D0C90EAA85081A3A2BD7C57AE6DC822EFCCBD66620C67B0103FC8DD280E36C3B282977B722AAEC3C56518EDCEBAFB72C5A05312"

Web/src/layout/lockScreen/index.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ const onLockScreenSubmit = async () => {
195195
try {
196196
// SM2加密密码
197197
// const keys = SM2.generateKeyPair();
198-
const publicKey = `0484C7466D950E120E5ECE5DD85D0C90EAA85081A3A2BD7C57AE6DC822EFCCBD66620C67B0103FC8DD280E36C3B282977B722AAEC3C56518EDCEBAFB72C5A05312`;
198+
const publicKey = window.__env__.VITE_SM_PUBLIC_KEY;
199199
const password = sm2.doEncrypt(state.lockScreenPassword, publicKey, 1);
200200
const [err, res] = await feature(getAPI(SysAuthApi).apiSysAuthUnLockScreenPost(password));
201201
if (err) {

Web/src/views/login/component/account.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ const onSignIn = async () => {
160160
161161
// SM2加密密码
162162
// const keys = SM2.generateKeyPair();
163-
const publicKey = `0484C7466D950E120E5ECE5DD85D0C90EAA85081A3A2BD7C57AE6DC822EFCCBD66620C67B0103FC8DD280E36C3B282977B722AAEC3C56518EDCEBAFB72C5A05312`;
163+
const publicKey = window.__env__.VITE_SM_PUBLIC_KEY;
164164
const password = sm2.doEncrypt(state.ruleForm.password, publicKey, 1);
165165
166166
const [err, res] = await feature(getAPI(SysAuthApi).apiSysAuthLoginPost({ ...state.ruleForm, password: password }));

Web/src/views/system/user/component/userCenter.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ const submitPassword = () => {
293293
294294
// SM2加密密码
295295
const cpwd: ChangePwdInput = { passwordOld: '', passwordNew: '' };
296-
const publicKey = `0484C7466D950E120E5ECE5DD85D0C90EAA85081A3A2BD7C57AE6DC822EFCCBD66620C67B0103FC8DD280E36C3B282977B722AAEC3C56518EDCEBAFB72C5A05312`;
296+
const publicKey = window.__env__.VITE_SM_PUBLIC_KEY;
297297
cpwd.passwordOld = sm2.doEncrypt(state.ruleFormPassword.passwordOld, publicKey, 1);
298298
cpwd.passwordNew = sm2.doEncrypt(state.ruleFormPassword.passwordNew, publicKey, 1);
299299
await getAPI(SysUserApi).apiSysUserChangePwdPost(cpwd);

0 commit comments

Comments
 (0)