mirror of
https://github.com/bitwarden/browser
synced 2025-12-19 17:53:39 +00:00
Ps/fix biometric prompt error on close (#8353)
* Fix error on close due to context differences in background Desktop background does not have active user information. Also, we want to delete _all_ prompt cancelled data, not just that for the active user. Storing this on global and manipulating observables to active achieves this without needing any user information in the background. * Remove potentially orphaned data * Throw nice error if prompt cancelled used without active user * Register migration * split prompt cancelled reset to user-specific and global
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { KeyDefinitionLike, MigrationHelper } from "../migration-helper";
|
||||
import { IRREVERSIBLE, Migrator } from "../migrator";
|
||||
|
||||
export const PROMPT_CANCELLED: KeyDefinitionLike = {
|
||||
key: "promptCancelled",
|
||||
stateDefinition: { name: "biometricSettings" },
|
||||
};
|
||||
|
||||
export class DeleteBiometricPromptCancelledData extends Migrator<45, 46> {
|
||||
async migrate(helper: MigrationHelper): Promise<void> {
|
||||
await Promise.all(
|
||||
(await helper.getAccounts()).map(async ({ userId }) => {
|
||||
if (helper.getFromUser(userId, PROMPT_CANCELLED) != null) {
|
||||
await helper.removeFromUser(userId, PROMPT_CANCELLED);
|
||||
}
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
async rollback(helper: MigrationHelper): Promise<void> {
|
||||
throw IRREVERSIBLE;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user