mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 00:33:44 +00:00
[bug] Address existing data & defaults when migrating from an unauthenticated state (#626)
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user