Properly reset data when logging out to avoid data leakage

This commit is contained in:
Flashfyre 2024-04-09 18:48:34 -04:00
parent 3e5a0d5c9c
commit 15e3fefd80
2 changed files with 5 additions and 2 deletions

View File

@ -591,7 +591,10 @@ export default class BattleScene extends SceneBase {
return this.currentBattle.randSeedInt(this, range, min); return this.currentBattle.randSeedInt(this, range, min);
} }
reset(clearScene?: boolean): void { reset(clearScene: boolean = false, clearData: boolean = false): void {
if (clearData)
this.gameData = new GameData(this);
this.gameMode = gameModes[GameModes.CLASSIC]; this.gameMode = gameModes[GameModes.CLASSIC];
this.setSeed(SEED_OVERRIDE || Utils.randomString(24)); this.setSeed(SEED_OVERRIDE || Utils.randomString(24));

View File

@ -284,7 +284,7 @@ export default class MenuUiHandler extends MessageUiHandler {
if (!res.ok) if (!res.ok)
console.error(`Log out failed (${res.status}: ${res.statusText})`); console.error(`Log out failed (${res.status}: ${res.statusText})`);
Utils.setCookie(Utils.sessionIdKey, ''); Utils.setCookie(Utils.sessionIdKey, '');
updateUserInfo().then(() => this.scene.reset(true)); updateUserInfo().then(() => this.scene.reset(true, true));
}); });
}; };
if (this.scene.currentBattle) { if (this.scene.currentBattle) {