mirror of
https://github.com/bitwarden/browser
synced 2026-02-08 12:40:26 +00:00
Apply more fixes
This commit is contained in:
@@ -8,4 +8,5 @@ export abstract class SyncedUnlockService {
|
||||
abstract getUserStatusFromDesktop(userId: UserId): Promise<AuthenticationStatus>;
|
||||
abstract getUserKeyFromDesktop(userId: UserId): Promise<UserKey | null>;
|
||||
abstract focusDesktopApp(): Promise<void>;
|
||||
abstract isConnectionTrusted(): Promise<boolean>;
|
||||
}
|
||||
|
||||
@@ -24,4 +24,8 @@ export class NoopSyncedUnlockService extends SyncedUnlockService {
|
||||
focusDesktopApp(): Promise<void> {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
isConnectionTrusted(): Promise<boolean> {
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,11 +16,8 @@
|
||||
</form>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="showLocalUnlockOptions">
|
||||
<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 class="tw-text-center tw-mb-3" *ngIf="unlockViaDesktop">
|
||||
{{ synchronizedUnlockUnavailabilityReason }}
|
||||
</bit-hint>
|
||||
|
||||
<!-- Biometrics Unlock -->
|
||||
|
||||
@@ -139,8 +139,10 @@ export class LockComponent implements OnInit, OnDestroy {
|
||||
|
||||
unlockViaDesktop = false;
|
||||
isDesktopOpen = false;
|
||||
isDesktopConnectionTrusted = false;
|
||||
activeUserLoggedOut = false;
|
||||
showLocalUnlockOptions = true;
|
||||
synchronizedUnlockUnavailabilityReason: string = "";
|
||||
desktopUnlockFormGroup: FormGroup = new FormGroup({});
|
||||
|
||||
constructor(
|
||||
@@ -224,14 +226,41 @@ export class LockComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
this.isDesktopOpen = await this.syncedUnlockService.isConnected();
|
||||
this.isDesktopConnectionTrusted = await this.syncedUnlockService.isConnectionTrusted();
|
||||
this.activeUserLoggedOut =
|
||||
(await this.syncedUnlockService.getUserStatusFromDesktop(activeAccount.id)) ===
|
||||
AuthenticationStatus.LoggedOut;
|
||||
this.showLocalUnlockOptions = !(
|
||||
this.isDesktopOpen &&
|
||||
this.unlockViaDesktop &&
|
||||
!this.activeUserLoggedOut
|
||||
);
|
||||
|
||||
// Synchronized unlock not enabled
|
||||
if (!this.unlockViaDesktop) {
|
||||
this.showLocalUnlockOptions = true;
|
||||
this.synchronizedUnlockUnavailabilityReason = "";
|
||||
return;
|
||||
}
|
||||
|
||||
// Synchronized unlock enabled, but cannot be used
|
||||
if (!this.isDesktopOpen) {
|
||||
this.showLocalUnlockOptions = true;
|
||||
this.synchronizedUnlockUnavailabilityReason = this.i18nService.t(
|
||||
"lockScreenDesktopNotRunning",
|
||||
);
|
||||
return;
|
||||
} else if (this.activeUserLoggedOut) {
|
||||
this.showLocalUnlockOptions = true;
|
||||
this.synchronizedUnlockUnavailabilityReason = this.i18nService.t(
|
||||
"lockScreenDesktopRunningButLoggedOut",
|
||||
);
|
||||
return;
|
||||
} else if (!this.isDesktopConnectionTrusted) {
|
||||
this.showLocalUnlockOptions = true;
|
||||
this.synchronizedUnlockUnavailabilityReason = this.i18nService.t(
|
||||
"lockScreenDesktopRunningButNotTrusted",
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
this.showLocalUnlockOptions = false;
|
||||
this.synchronizedUnlockUnavailabilityReason = "";
|
||||
} catch (e) {
|
||||
this.logService.error(e);
|
||||
}
|
||||
|
||||
@@ -6,4 +6,5 @@ export enum SyncedUnlockStateCommands {
|
||||
GetUserKeyFromDesktop = "getUserKeyFromDesktop",
|
||||
GetUserStatusFromDesktop = "getUserStatusFromDesktop",
|
||||
FocusDesktopApp = "focusDesktopApp",
|
||||
IsConnectionTrusted = "isConnectionTrusted",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user