fix(388-1 · 388-3 보안): 로그아웃 · 계정 바뀜 지움 · 세션 넘침 · 탭 프로젝트 고정

- 로그아웃 = 떠남 확인 먼저 → 서버 로그아웃 → 세션 전부 · 현재 프로젝트 · 3D 지형 지움 → 홈 새로고침
- 계정 바뀜(저장한 주인 ≠ 지금 사용자) = 같은 지움 뒤 새로고침 · 열쇠에 계정 안 섞음
- 세션 한도 넘침 = 결과 칸 비우고 한 번 다시 · 그래도 넘치면 「저장 공간 부족」 안내
- B05 · B06 이 연 프로젝트 고정 — 다른 탭이 바꿔도 이 탭 초안 칸 그대로
- 새 test_384_s_logout_wipe

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VmC34fsxxbweEG3RUjs3Mn
This commit is contained in:
2026-10-17 17:21:38 +09:00
co-authored by Claude Opus 5.5
parent 23c6645839
commit 3e312b68d7
8 changed files with 281 additions and 5 deletions
+32
View File
@@ -8,6 +8,7 @@
* 같은 프로젝트로 다시 들어오면(새로고침 포함) 아무것도 안 지운다(탭마다 들어온 표식).
* ========================================================================== */
import { CURRENT_PROJECT_ID_KEY } from "@config/config_frontend";
import { showConfirmDialog } from "@ui/ui_template_elements";
import { purgeOtherProjects } from "./b_asset_cache";
import { STATE_REGISTRY, type StateEntry } from "./b_page_state";
@@ -120,3 +121,34 @@ export async function enterProject(
/* 저장소가 막힌 브라우저 — 캐시를 못 지워도 프로젝트는 연다. */
}
}
/** 이 브라우저에 자료를 남긴 계정(388-1) — 열쇠에는 안 섞고 바뀜 판정에만. */
const OWNER_KEY = "aislo:owner";
/**
* 계정이 떠남 · 바뀜(388-1) — 이 탭 세션 전부(초안 · 결과 · 들어온 표식) · 현재 프로젝트 ·
* 3D 지형 보관함을 지운다. 계정 취향(localStorage pref)은 남긴다. 부른 쪽이 새로고침해 모듈 메모리도 버림.
*/
export async function wipeAccountCache(): Promise<void> {
try {
window.sessionStorage.clear();
window.localStorage.removeItem(CURRENT_PROJECT_ID_KEY);
} catch {
/* 저장소가 막힌 브라우저 — 지울 것이 없다. */
}
await purgeOtherProjects(""); // 빈 id 보다 큰 열쇠 = 모든 프로젝트
}
/** 로그인 확인 때 — 앞서 자료를 남긴 계정과 다르면 지우고 true(부른 쪽이 새로고침). */
export async function wipeIfOwnerChanged(userId: string): Promise<boolean> {
let previous: string | null = null;
try {
previous = window.localStorage.getItem(OWNER_KEY);
window.localStorage.setItem(OWNER_KEY, userId);
} catch {
return false;
}
if (previous === userId) return false;
await wipeAccountCache();
return true;
}