mirror of
https://github.com/bitwarden/browser
synced 2026-02-12 22:44:11 +00:00
Apply small fixes
This commit is contained in:
@@ -2177,6 +2177,9 @@
|
||||
"lockScreenDesktopNotRunning": {
|
||||
"message": "This user's account is synchronized with the desktop app, but the desktop app is not running."
|
||||
},
|
||||
"lockScreenDesktopRunningButLoggedOut": {
|
||||
"message": "User account synchronization is enabled, but the active account is logged out in the desktop app."
|
||||
},
|
||||
"unlockWithBiometrics": {
|
||||
"message": "Unlock with biometrics"
|
||||
},
|
||||
|
||||
@@ -131,6 +131,12 @@ export class AccountSwitcherComponent implements OnInit, OnDestroy {
|
||||
|
||||
async lockAll() {
|
||||
this.loading = true;
|
||||
|
||||
const accounts = await firstValueFrom(this.accountService.accounts$);
|
||||
for (const userId of Object.keys(accounts) as UserId[]) {
|
||||
await this.foregroundSyncedUnlockService.lock(userId);
|
||||
}
|
||||
|
||||
await this.lockService.lockAll();
|
||||
await this.router.navigate(["lock"]);
|
||||
}
|
||||
|
||||
@@ -298,18 +298,18 @@ export class NativeMessagingBackground {
|
||||
|
||||
const callback = new Promise((resolver, rejecter) => {
|
||||
this.callbacks.set(messageId, { resolver, rejecter });
|
||||
message.messageId = messageId;
|
||||
this.send(message)
|
||||
.then(() => {})
|
||||
.catch((e) => {
|
||||
this.logService.error(
|
||||
`[Native Messaging IPC] Error sending message of type ${message.command} to Bitwarden Desktop app. Error: ${e}`,
|
||||
);
|
||||
const callback = this.callbacks.get(messageId);
|
||||
this.callbacks.delete(messageId);
|
||||
callback?.rejecter("errorConnecting");
|
||||
});
|
||||
});
|
||||
message.messageId = messageId;
|
||||
try {
|
||||
await this.send(message);
|
||||
} catch (e) {
|
||||
this.logService.info(
|
||||
`[Native Messaging IPC] Error sending message of type ${message.command} to Bitwarden Desktop app. Error: ${e}`,
|
||||
);
|
||||
const callback = this.callbacks.get(messageId);
|
||||
this.callbacks.delete(messageId);
|
||||
callback?.rejecter("errorConnecting");
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
if (this.callbacks.has(messageId)) {
|
||||
|
||||
@@ -43,7 +43,7 @@ export class ForegroundSyncedUnlockService extends SyncedUnlockService {
|
||||
result: AuthenticationStatus;
|
||||
error: string;
|
||||
}>(SyncedUnlockStateCommands.GetUserStatusFromDesktop, { userId });
|
||||
if (!response.result) {
|
||||
if (response.result == null) {
|
||||
throw response.error;
|
||||
}
|
||||
return response.result;
|
||||
@@ -54,7 +54,7 @@ export class ForegroundSyncedUnlockService extends SyncedUnlockService {
|
||||
result: UserKey;
|
||||
error: string;
|
||||
}>(SyncedUnlockStateCommands.GetUserKeyFromDesktop, { userId });
|
||||
if (!response.result) {
|
||||
if (response.result == null) {
|
||||
return null;
|
||||
}
|
||||
return response.result;
|
||||
@@ -65,7 +65,7 @@ export class ForegroundSyncedUnlockService extends SyncedUnlockService {
|
||||
result: boolean;
|
||||
error: string;
|
||||
}>(SyncedUnlockStateCommands.FocusDesktopApp);
|
||||
if (!response.result) {
|
||||
if (response.result == null) {
|
||||
throw response.error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,6 +157,7 @@ Terminal=false`;
|
||||
|
||||
private setFocus() {
|
||||
this.main.trayMain.restoreFromTray();
|
||||
this.main.windowMain.win.focus();
|
||||
this.main.windowMain.win.focusOnWebView();
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
<ng-container *ngIf="!showLocalUnlockOptions">
|
||||
<form [bitSubmit]="submit" [formGroup]="desktopUnlockFormGroup">
|
||||
<div class="tw-flex tw-flex-col tw-space-y-3">
|
||||
<bit-hint class="tw-text-center">{{ "lockScreenSynchronizedNote" | i18n }}</bit-hint
|
||||
>
|
||||
<bit-hint class="tw-text-center">{{ "lockScreenSynchronizedNote" | i18n }}</bit-hint>
|
||||
<button type="submit" bitButton bitFormButton buttonType="primary" block>
|
||||
{{ "lockScreenContinueInDesktop" | i18n }}
|
||||
</button>
|
||||
@@ -17,9 +16,12 @@
|
||||
</form>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="showLocalUnlockOptions">
|
||||
<bit-hint class="tw-text-center tw-mb-3" *ngIf="unlockViaDesktop">
|
||||
<bit-hint class="tw-text-center tw-mb-3" *ngIf="unlockViaDesktop && !activeUserLoggedOut">
|
||||
{{ "lockScreenDesktopNotRunning" | i18n }}
|
||||
</bit-hint>
|
||||
<bit-hint class="tw-text-center tw-mb-3" *ngIf="unlockViaDesktop && activeUserLoggedOut">
|
||||
{{ "lockScreenDesktopRunningButLoggedOut" | i18n }}
|
||||
</bit-hint>
|
||||
|
||||
<!-- Biometrics Unlock -->
|
||||
<ng-container *ngIf="activeUnlockOption === UnlockOption.Biometrics">
|
||||
|
||||
@@ -22,6 +22,7 @@ import { InternalPolicyService } from "@bitwarden/common/admin-console/abstracti
|
||||
import { MasterPasswordPolicyOptions } from "@bitwarden/common/admin-console/models/domain/master-password-policy-options";
|
||||
import { Account, AccountService } from "@bitwarden/common/auth/abstractions/account.service";
|
||||
import { UserVerificationService } from "@bitwarden/common/auth/abstractions/user-verification/user-verification.service.abstraction";
|
||||
import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authentication-status";
|
||||
import { VerificationType } from "@bitwarden/common/auth/enums/verification-type";
|
||||
import { ForceSetPasswordReason } from "@bitwarden/common/auth/models/domain/force-set-password-reason";
|
||||
import { getUserId } from "@bitwarden/common/auth/services/account.service";
|
||||
@@ -138,6 +139,7 @@ export class LockComponent implements OnInit, OnDestroy {
|
||||
|
||||
unlockViaDesktop = false;
|
||||
isDesktopOpen = false;
|
||||
activeUserLoggedOut = false;
|
||||
showLocalUnlockOptions = true;
|
||||
desktopUnlockFormGroup: FormGroup = new FormGroup({});
|
||||
|
||||
@@ -212,12 +214,24 @@ export class LockComponent implements OnInit, OnDestroy {
|
||||
takeUntil(this.destroy$),
|
||||
)
|
||||
.subscribe();
|
||||
interval(500)
|
||||
interval(1000)
|
||||
.pipe(
|
||||
switchMap(async () => {
|
||||
try {
|
||||
const activeAccount = await firstValueFrom(this.accountService.activeAccount$);
|
||||
if (activeAccount == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.isDesktopOpen = await this.syncedUnlockService.isConnected();
|
||||
this.showLocalUnlockOptions = !(this.isDesktopOpen && this.unlockViaDesktop);
|
||||
this.activeUserLoggedOut =
|
||||
(await this.syncedUnlockService.getUserStatusFromDesktop(activeAccount.id)) ===
|
||||
AuthenticationStatus.LoggedOut;
|
||||
this.showLocalUnlockOptions = !(
|
||||
this.isDesktopOpen &&
|
||||
this.unlockViaDesktop &&
|
||||
!this.activeUserLoggedOut
|
||||
);
|
||||
} catch (e) {
|
||||
this.logService.error(e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user