File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 53215321 "message" : " Learn more about SSH agent" ,
53225322 "description" : " Two part message" ,
53235323 "example" : " Store your keys and connect with the SSH agent for fast, encrypted authentication. Learn more about SSH agent"
5324+ },
5325+ "noPermissionsViewPage" : {
5326+ "message" : " You do not have permissions to view this page. Try logging in with a different account."
53245327 }
53255328}
Original file line number Diff line number Diff line change 11import { inject } from "@angular/core" ;
2- import { CanActivateFn } from "@angular/router" ;
3- import { switchMap , tap } from "rxjs" ;
2+ import { CanActivateFn , Router } from "@angular/router" ;
3+ import { map , switchMap } from "rxjs" ;
44
55import { AccountService } from "@bitwarden/common/auth/abstractions/account.service" ;
66import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service" ;
@@ -13,18 +13,22 @@ export const canAccessAtRiskPasswords: CanActivateFn = () => {
1313 const taskService = inject ( TaskService ) ;
1414 const toastService = inject ( ToastService ) ;
1515 const i18nService = inject ( I18nService ) ;
16+ const router = inject ( Router ) ;
1617
1718 return accountService . activeAccount$ . pipe (
1819 filterOutNullish ( ) ,
1920 switchMap ( ( user ) => taskService . tasksEnabled$ ( user . id ) ) ,
20- tap ( ( tasksEnabled ) => {
21+ map ( ( tasksEnabled ) => {
2122 if ( ! tasksEnabled ) {
2223 toastService . showToast ( {
2324 variant : "error" ,
2425 title : "" ,
25- message : i18nService . t ( "accessDenied " ) ,
26+ message : i18nService . t ( "noPermissionsViewPage " ) ,
2627 } ) ;
28+
29+ return router . createUrlTree ( [ "/tabs/vault" ] ) ;
2730 }
31+ return true ;
2832 } ) ,
2933 ) ;
3034} ;
You can’t perform that action at this time.
0 commit comments