mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 16:23:44 +00:00
check if authed before trying to lock
This commit is contained in:
@@ -9,6 +9,7 @@ import { MessagingService } from '../abstractions/messaging.service';
|
|||||||
import { PlatformUtilsService } from '../abstractions/platformUtils.service';
|
import { PlatformUtilsService } from '../abstractions/platformUtils.service';
|
||||||
import { SearchService } from '../abstractions/search.service';
|
import { SearchService } from '../abstractions/search.service';
|
||||||
import { StorageService } from '../abstractions/storage.service';
|
import { StorageService } from '../abstractions/storage.service';
|
||||||
|
import { UserService } from '../abstractions/user.service';
|
||||||
|
|
||||||
export class LockService implements LockServiceAbstraction {
|
export class LockService implements LockServiceAbstraction {
|
||||||
pinLocked = false;
|
pinLocked = false;
|
||||||
@@ -19,7 +20,7 @@ export class LockService implements LockServiceAbstraction {
|
|||||||
private collectionService: CollectionService, private cryptoService: CryptoService,
|
private collectionService: CollectionService, private cryptoService: CryptoService,
|
||||||
private platformUtilsService: PlatformUtilsService, private storageService: StorageService,
|
private platformUtilsService: PlatformUtilsService, private storageService: StorageService,
|
||||||
private messagingService: MessagingService, private searchService: SearchService,
|
private messagingService: MessagingService, private searchService: SearchService,
|
||||||
private lockedCallback: () => Promise<void> = null) {
|
private userService: UserService, private lockedCallback: () => Promise<void> = null) {
|
||||||
}
|
}
|
||||||
|
|
||||||
init(checkOnInterval: boolean) {
|
init(checkOnInterval: boolean) {
|
||||||
@@ -48,6 +49,11 @@ export class LockService implements LockServiceAbstraction {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const authed = await this.userService.isAuthenticated();
|
||||||
|
if (!authed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (await this.isLocked()) {
|
if (await this.isLocked()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -74,6 +80,11 @@ export class LockService implements LockServiceAbstraction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async lock(allowSoftLock = false): Promise<void> {
|
async lock(allowSoftLock = false): Promise<void> {
|
||||||
|
const authed = await this.userService.isAuthenticated();
|
||||||
|
if (!authed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (allowSoftLock) {
|
if (allowSoftLock) {
|
||||||
const pinSet = await this.isPinLockSet();
|
const pinSet = await this.isPinLockSet();
|
||||||
if (pinSet[0]) {
|
if (pinSet[0]) {
|
||||||
|
|||||||
Reference in New Issue
Block a user