From f70b70eec5e1aa1428d3888233e259e8c52ce8b6 Mon Sep 17 00:00:00 2001 From: jack <jack.su@pollex.com.tw> Date: 星期五, 08 九月 2023 17:18:51 +0800 Subject: [PATCH] [UPDATE] 解決弱掃Information exposure to log file, 將印在log的私密資料移除 --- PAMapp/store/localStorage.ts | 39 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 39 insertions(+), 0 deletions(-) diff --git a/PAMapp/store/localStorage.ts b/PAMapp/store/localStorage.ts index a2c1bb9..d1fd32c 100644 --- a/PAMapp/store/localStorage.ts +++ b/PAMapp/store/localStorage.ts @@ -1,15 +1,20 @@ import { Module, Mutation, VuexModule ,Action } from 'vuex-module-decorators'; +import { ContactType } from '~/shared/models/enum/ContactType'; import { Role } from '~/shared/models/enum/Role'; import { Selected } from '~/shared/models/quick-filter.model'; +import { RegisterInfo } from '~/shared/models/registerInfo'; +import { StrictQueryParams } from '~/shared/models/strict-query.model'; @Module export default class LocalStorage extends VuexModule { id_token = localStorage.getItem('id_token'); current_role= localStorage.getItem('current_role'); consultant_id = localStorage.getItem('consultant_id'); + userInfo = JSON.parse(localStorage.getItem('userInfo')!); quickFilterSelectedItem = localStorage.getItem('quickFilter'); recommendConsultantItem = localStorage.getItem('recommendConsultantItem'); appointmentIdFromMsg = localStorage.getItem('appointmentIdFromMsg'); satisfactionIdFromMsg = localStorage.getItem('satisfactionIdFromMsg'); + notContactAppointmentIdFromMsg = localStorage.getItem('notContactAppointmentIdFromMsg'); get idToken(): string|null { return this.id_token; @@ -22,6 +27,11 @@ get consultantId():string|null{ return this.consultant_id; } + + get isPrimaryContactTypeEmail(): boolean { + return this.userInfo.contactType === ContactType.EMAIL; + } + get quickFilterSelectedData(): Selected[] { return JSON.parse(this.quickFilterSelectedItem || '[]') as Selected[]; @@ -41,6 +51,15 @@ get currentSatisfactionIdFromMsg(): string|null { return this.satisfactionIdFromMsg; + } + + get currentNotContactAppointmentIdFromMsg(): string|null { + return this.notContactAppointmentIdFromMsg; + } + + @Mutation storageUserInfo(userInfo: RegisterInfo): void { + localStorage.setItem('userInfo', JSON.stringify(userInfo)); + this.userInfo = JSON.parse(localStorage.getItem('userInfo')!); } @Mutation storageIdToken(token: string): void { @@ -78,12 +97,22 @@ this.satisfactionIdFromMsg = localStorage.getItem('satisfactionIdFromMsg'); } + @Mutation storageNotContactAppointmentIdFromMsg(id: string) { + localStorage.setItem('notContactAppointmentIdFromMsg', id); + this.notContactAppointmentIdFromMsg = id; + } + @Mutation storageClear(): void { localStorage.removeItem('myRequests'); localStorage.removeItem('userInfo'); localStorage.removeItem('id_token'); localStorage.removeItem('current_role'); localStorage.removeItem('consultant_id'); + localStorage.removeItem('appointment'); + localStorage.removeItem('login_consultant'); + localStorage.removeItem('notContactAppointmentIdFromMsg'); + localStorage.removeItem('satisfactionIdFromMsg'); + localStorage.removeItem('appointmentIdFromMsg'); this.id_token = localStorage.getItem('id_token'); this.current_role = localStorage.getItem('current_role'); this.consultant_id = localStorage.getItem('consultant_id'); @@ -110,6 +139,16 @@ this.appointmentIdFromMsg = localStorage.getItem('satisfactionIdFromMsg'); } + @Mutation storageClearNotContactAppointmentIdFromMsg() { + localStorage.removeItem('notContactAppointmentIdFromMsg'); + this.appointmentIdFromMsg = localStorage.getItem('notContactAppointmentIdFromMsg'); + } + + @Mutation storageStrickQueryItem(queryItem: StrictQueryParams): void { + localStorage.setItem('recommendConsultantItem', JSON.stringify(queryItem)); + this.recommendConsultantItem = localStorage.getItem('recommendConsultantItem'); + } + @Action actionStorageClear(): void { this.context.commit("storageClear"); } -- Gitblit v1.9.3