mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 07:43:35 +00:00
[PS-1175] Resolve issue with processReload not executing (#3240)
* Removed check for getBiometricLocked It always returned false even when no biometrics were used. * Remove the other check for getBiometricsLocked * Ensure that biometricFingerprintValidation is reset, when biometrics are disabled * Removed getBiometricsLocked and setBiometricsLocked With nothing in the codebase reading the state of getBiometricsLocked, I've removed all places where it was set or saved. * Refactor execution of reload into a separate method * Conditonally pass the window object to `BrowserApi.reloadExtension` * Clarify in comment, that the PIN has to be set with ask for Master Password on restart * Ensure the process reload is executed on logout * Use accounts instead of lastActive == null to determine a reload on logout * Moved identical logic from desktop and browser into system.service * Simplified check for refresh to handle no accounts found, logout, lock with lastActive longer than 5 seconds
This commit is contained in:
committed by
GitHub
parent
df7377d305
commit
a1e536a5ef
@@ -183,7 +183,7 @@ export default class MainBackground {
|
||||
await this.refreshBadgeAndMenu(true);
|
||||
if (this.systemService != null) {
|
||||
await this.systemService.clearPendingClipboard();
|
||||
await this.reloadProcess();
|
||||
await this.systemService.startProcessReload(this.authService);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -634,7 +634,7 @@ export default class MainBackground {
|
||||
await this.reseedStorage();
|
||||
this.notificationsService.updateConnection(false);
|
||||
await this.systemService.clearPendingClipboard();
|
||||
await this.reloadProcess();
|
||||
await this.systemService.startProcessReload(this.authService);
|
||||
}
|
||||
|
||||
async collectPageDetailsForContentScript(tab: any, sender: string, frameId: number = null) {
|
||||
@@ -1041,16 +1041,4 @@ export default class MainBackground {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private async reloadProcess(): Promise<void> {
|
||||
const accounts = this.stateService.accounts.getValue();
|
||||
if (accounts != null) {
|
||||
for (const userId of Object.keys(accounts)) {
|
||||
if ((await this.authService.getAuthStatus(userId)) === AuthenticationStatus.Unlocked) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
await this.systemService.startProcessReload();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,7 +323,6 @@ export class NativeMessagingBackground {
|
||||
return;
|
||||
}
|
||||
|
||||
await this.stateService.setBiometricLocked(false);
|
||||
this.runtimeBackground.processMessage({ command: "unlocked" }, null, null);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -107,14 +107,15 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||
this.showToast(msg);
|
||||
});
|
||||
} else if (msg.command === "reloadProcess") {
|
||||
const windowReload =
|
||||
const forceWindowReload =
|
||||
this.platformUtilsService.isSafari() ||
|
||||
this.platformUtilsService.isFirefox() ||
|
||||
this.platformUtilsService.isOpera();
|
||||
if (windowReload) {
|
||||
// Wait to make sure background has reloaded first.
|
||||
window.setTimeout(() => BrowserApi.reloadExtension(window), 2000);
|
||||
}
|
||||
// Wait to make sure background has reloaded first.
|
||||
window.setTimeout(
|
||||
() => BrowserApi.reloadExtension(forceWindowReload ? window : null),
|
||||
2000
|
||||
);
|
||||
} else if (msg.command === "reloadPopup") {
|
||||
this.ngZone.run(() => {
|
||||
this.router.navigate(["/"]);
|
||||
|
||||
@@ -293,7 +293,7 @@ export class SettingsComponent implements OnInit {
|
||||
]);
|
||||
} else {
|
||||
await this.stateService.setBiometricUnlock(null);
|
||||
await this.stateService.setBiometricLocked(false);
|
||||
await this.stateService.setBiometricFingerprintValidated(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -276,7 +276,6 @@ export class SettingsComponent implements OnInit {
|
||||
if (!newValue || !this.supportsBiometric) {
|
||||
this.biometric = false;
|
||||
await this.stateService.setBiometricUnlock(null);
|
||||
await this.stateService.setBiometricLocked(false);
|
||||
await this.cryptoService.toggleKey();
|
||||
return;
|
||||
}
|
||||
@@ -290,7 +289,6 @@ export class SettingsComponent implements OnInit {
|
||||
|
||||
this.biometric = true;
|
||||
await this.stateService.setBiometricUnlock(true);
|
||||
await this.stateService.setBiometricLocked(false);
|
||||
await this.cryptoService.toggleKey();
|
||||
}
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ export class AppComponent implements OnInit {
|
||||
this.notificationsService.updateConnection();
|
||||
this.updateAppMenu();
|
||||
await this.systemService.clearPendingClipboard();
|
||||
await this.reloadProcess();
|
||||
await this.systemService.startProcessReload(this.authService);
|
||||
break;
|
||||
case "authBlocked":
|
||||
this.router.navigate(["login"]);
|
||||
@@ -189,7 +189,7 @@ export class AppComponent implements OnInit {
|
||||
this.notificationsService.updateConnection();
|
||||
await this.updateAppMenu();
|
||||
await this.systemService.clearPendingClipboard();
|
||||
await this.reloadProcess();
|
||||
await this.systemService.startProcessReload(this.authService);
|
||||
break;
|
||||
case "reloadProcess":
|
||||
(window.location as any).reload(true);
|
||||
@@ -470,8 +470,6 @@ export class AppComponent implements OnInit {
|
||||
this.keyConnectorService.clear(),
|
||||
]);
|
||||
|
||||
await this.stateService.setBiometricLocked(true, { userId: userBeingLoggedOut });
|
||||
|
||||
if (userBeingLoggedOut === this.activeUserId) {
|
||||
this.searchService.clearIndex();
|
||||
this.authService.logOut(async () => {
|
||||
@@ -585,21 +583,6 @@ export class AppComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
private async reloadProcess(): Promise<void> {
|
||||
const accounts = this.stateService.accounts.getValue();
|
||||
if (accounts != null) {
|
||||
const keys = Object.keys(accounts);
|
||||
if (keys.length > 0) {
|
||||
for (const userId of keys) {
|
||||
if ((await this.authService.getAuthStatus(userId)) === AuthenticationStatus.Unlocked) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
await this.systemService.startProcessReload();
|
||||
}
|
||||
|
||||
private async checkForSystemTimeout(timeout: number): Promise<void> {
|
||||
for (const userId in this.stateService.accounts.getValue()) {
|
||||
if (userId == null) {
|
||||
|
||||
Reference in New Issue
Block a user