diff --git a/libs/angular/src/auth/guards/auth.guard.ts b/libs/angular/src/auth/guards/auth.guard.ts index 8e8e70a6d29..37c464a804d 100644 --- a/libs/angular/src/auth/guards/auth.guard.ts +++ b/libs/angular/src/auth/guards/auth.guard.ts @@ -74,13 +74,6 @@ export const authGuard: CanActivateFn = async ( return router.createUrlTree(["lock"], { queryParams: { promptBiometric: true } }); } - if ( - !routerState.url.includes("remove-password") && - (await firstValueFrom(keyConnectorService.convertAccountRequired$)) - ) { - return router.createUrlTree(["/remove-password"]); - } - // Handle cases where a user needs to set a password when they don't already have one: // - TDE org user has been given "manage account recovery" permission // - TDE offboarding on a trusted device, where we have access to their encryption key wrap with their new password @@ -106,5 +99,14 @@ export const authGuard: CanActivateFn = async ( return router.createUrlTree([route]); } + // Remove password when Key Connector is enabled + if ( + forceSetPasswordReason == ForceSetPasswordReason.None && + !routerState.url.includes("remove-password") && + (await firstValueFrom(keyConnectorService.convertAccountRequired$)) + ) { + return router.createUrlTree(["/remove-password"]); + } + return true; };