1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-09-14 02:08:50 +02:00

[bug] Address existing data & defaults when migrating from an unauthenticated state (#626)

This commit is contained in:
Addison Beck 2022-01-21 12:41:15 -05:00 committed by GitHub
parent 69fe7b8339
commit 9b0e5ae456
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -2219,6 +2219,7 @@ export class StateService<TAccount extends Account = Account>
await this.storageService.remove(keys.tempAccountSettings);
}
account.settings.environmentUrls = environmentUrls;
Object.assign(account.settings, this.createAccount().settings);
await this.storageService.save(
account.profile.userId,
account,

View File

@ -193,6 +193,12 @@ export class StateMigrationService {
alwaysShowDock: await this.get<boolean>(v1Keys.alwaysShowDock),
};
// Some processes, like biometrics, may have already defined a value before migrations are run
const existingGlobals = await this.get<GlobalState>(keys.global);
if (existingGlobals != null) {
Object.assign(globals, existingGlobals);
}
const userId =
(await this.get<string>(v1Keys.userId)) ?? (await this.get<string>(v1Keys.entityId));