Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions apps/browser/src/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -5321,5 +5321,8 @@
"message": "Learn more about SSH agent",
"description": "Two part message",
"example": "Store your keys and connect with the SSH agent for fast, encrypted authentication. Learn more about SSH agent"
},
"noPermissionsViewPage": {
"message": "You do not have permissions to view this page. Try logging in with a different account."
}
}
12 changes: 8 additions & 4 deletions apps/browser/src/vault/guards/at-risk-passwords.guard.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { inject } from "@angular/core";
import { CanActivateFn } from "@angular/router";
import { switchMap, tap } from "rxjs";
import { CanActivateFn, Router } from "@angular/router";
import { map, switchMap } from "rxjs";

Check warning on line 3 in apps/browser/src/vault/guards/at-risk-passwords.guard.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/vault/guards/at-risk-passwords.guard.ts#L2-L3

Added lines #L2 - L3 were not covered by tests

import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
Expand All @@ -13,18 +13,22 @@
const taskService = inject(TaskService);
const toastService = inject(ToastService);
const i18nService = inject(I18nService);
const router = inject(Router);

Check warning on line 16 in apps/browser/src/vault/guards/at-risk-passwords.guard.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/vault/guards/at-risk-passwords.guard.ts#L16

Added line #L16 was not covered by tests

return accountService.activeAccount$.pipe(
filterOutNullish(),
switchMap((user) => taskService.tasksEnabled$(user.id)),
tap((tasksEnabled) => {
map((tasksEnabled) => {
if (!tasksEnabled) {
toastService.showToast({
variant: "error",
title: "",
message: i18nService.t("accessDenied"),
message: i18nService.t("noPermissionsViewPage"),
});

return router.createUrlTree(["/tabs/vault"]);

Check warning on line 29 in apps/browser/src/vault/guards/at-risk-passwords.guard.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/vault/guards/at-risk-passwords.guard.ts#L29

Added line #L29 was not covered by tests
}
return true;

Check warning on line 31 in apps/browser/src/vault/guards/at-risk-passwords.guard.ts

View check run for this annotation

Codecov / codecov/patch

apps/browser/src/vault/guards/at-risk-passwords.guard.ts#L31

Added line #L31 was not covered by tests
}),
);
};
Loading