Răsfoiți Sursa

fix: 更新配置信息获取,安全数据解密使用

yanglzh 1 an în urmă
părinte
comite
0b01b1f07d
2 a modificat fișierele cu 9 adăugiri și 6 ștergeri
  1. 8 4
      src/App.vue
  2. 1 2
      src/views/login/component/account.vue

+ 8 - 4
src/App.vue

@@ -26,11 +26,15 @@ export default defineComponent({
 	components: { LockScreen, Setings, CloseFull },
 	async created() {
 		api.sysinfo().then((res: any) => {
-			// 安全开关是否开启 按钮权限,列表权限,rsa权限在开启安全权限下才使用
-			const isSecurityControlEnabled = res.isSecurityControlEnabled
 			localStorage.setItem('sysinfo', JSON.stringify(res));
-			sessionStorage.setItem('isSecurityControlEnabled', isSecurityControlEnabled ? '1' : '');
-			sessionStorage.setItem('isRsaEnabled', (isSecurityControlEnabled && res.isRsaEnabled) ? '1' : '');
+			// 使用的事base64加密的,解决之后的值  sysPasswordChangePeriod + "|" + isSecurityControlEnabled + "|" + isRsaEnabled
+			// 顺序是,密码变更周期,是否启动安全控制,是否启用rsa,中间你需要根据 | 切割一下
+			const [sysPasswordChangePeriod, isSecurityControlEnabled, isRsaEnabled] = window.atob(res.target).split('|')
+
+			// 安全开关是否开启 按钮权限,列表权限,rsa权限在开启安全权限下才使用
+			sessionStorage.setItem('isSecurityControlEnabled', Number(isSecurityControlEnabled) ? '1' : '');
+			sessionStorage.setItem('isRsaEnabled', (Number(isSecurityControlEnabled) && Number(isRsaEnabled)) ? '1' : '');
+			sessionStorage.setItem('sysPasswordChangePeriod', sysPasswordChangePeriod);
 		});
 	},
 	setup() {

+ 1 - 2
src/views/login/component/account.vue

@@ -131,8 +131,7 @@ export default defineComponent({
 							.then(async (res: any) => {
 								// 检查是否需要更换密码
 								if (res.isChangePwd) {
-									const sysinfo = JSON.parse(localStorage.sysinfo || '{}');
-									ElMessage.error(`密码已超过${sysinfo.passwordChangePeriod}天未修改,请先修改密码再登录`)
+									ElMessage.error(`密码已超过${sessionStorage.sysPasswordChangePeriod}天未修改,请先修改密码再登录`)
 									state.loading.signIn = false;
 									getCaptcha();
 									return changePwdRef.value.toShow({