mirror of
https://github.com/bitwarden/browser
synced 2025-12-22 19:23:52 +00:00
private mode component
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { BrowserApi } from '../../browser/browserApi';
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import {
|
||||
CanActivate,
|
||||
@@ -12,6 +14,11 @@ export class LaunchGuardService implements CanActivate {
|
||||
constructor(private cryptoService: CryptoService, private userService: UserService, private router: Router) { }
|
||||
|
||||
async canActivate() {
|
||||
if (BrowserApi.getBackgroundPage() == null) {
|
||||
this.router.navigate(['private-mode']);
|
||||
return false;
|
||||
}
|
||||
|
||||
const isAuthed = await this.userService.isAuthenticated();
|
||||
if (!isAuthed) {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user