feat(projects): clear tabs cache when switching users. #744
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
修复用户切换登录时未清理缓存标签页的问题
本PR解决了不同用户之间登录可能看到彼此标签页内容的安全隐患。通过在用户登出时记录当前用户ID,并在下次登录时比较用户ID是否变更,如果发现不同用户登录则自动清理所有标签页缓存。
具体实现
recordUserId
函数,用于在用户退出登录时记录当前用户ID到本地存储checkTabClear
函数,在用户登录成功后检查是否与上次登录用户一致tabStore.clearTabs()
清理所有非固定标签页解决的问题
之前系统会在用户退出登录时缓存标签页状态,但没有考虑到用户切换的情况,可能导致新用户看到上一个用户的标签页内容,存在潜在的信息泄露风险。本修复确保了不同用户间的标签页数据隔离。
Closes #721