diff --git a/angular/src/components/update-password.component.ts b/angular/src/components/update-password.component.ts index ce740b967c..fb2697b4fc 100644 --- a/angular/src/components/update-password.component.ts +++ b/angular/src/components/update-password.component.ts @@ -61,7 +61,6 @@ export class UpdatePasswordComponent extends BaseChangePasswordComponent { async cancel() { await this.stateService.setOrganizationInvitation(null); - await this.stateService.setLoginRedirect(null); this.router.navigate(["/vault"]); } diff --git a/angular/src/services/auth-guard.service.ts b/angular/src/services/auth-guard.service.ts index 8c06e438e9..fafcbfdfda 100644 --- a/angular/src/services/auth-guard.service.ts +++ b/angular/src/services/auth-guard.service.ts @@ -19,7 +19,7 @@ export class AuthGuardService implements CanActivate { async canActivate(route: ActivatedRouteSnapshot, routerState: RouterStateSnapshot) { const isAuthed = await this.stateService.getIsAuthenticated(); if (!isAuthed) { - this.messagingService.send("authBlocked"); + this.messagingService.send("authBlocked", { url: routerState.url }); return false; } @@ -28,16 +28,14 @@ export class AuthGuardService implements CanActivate { if (routerState != null) { this.messagingService.send("lockedUrl", { url: routerState.url }); } - this.router.navigate(["lock"], { queryParams: { promptBiometric: true } }); - return false; + return this.router.createUrlTree(["lock"], { queryParams: { promptBiometric: true } }); } if ( !routerState.url.includes("remove-password") && (await this.keyConnectorService.getConvertAccountRequired()) ) { - this.router.navigate(["/remove-password"]); - return false; + return this.router.createUrlTree(["/remove-password"]); } return true; diff --git a/angular/src/services/unauth-guard.service.ts b/angular/src/services/unauth-guard.service.ts index ee2da04578..89c08b195e 100644 --- a/angular/src/services/unauth-guard.service.ts +++ b/angular/src/services/unauth-guard.service.ts @@ -18,11 +18,9 @@ export class UnauthGuardService implements CanActivate { if (isAuthed) { const locked = await this.vaultTimeoutService.isLocked(); if (locked) { - this.router.navigate(["lock"]); - } else { - this.router.navigate([this.homepage]); + return this.router.createUrlTree(["lock"]); } - return false; + return this.router.createUrlTree([this.homepage]); } return true; } diff --git a/common/src/abstractions/state.service.ts b/common/src/abstractions/state.service.ts index ebf94df3d5..1069316408 100644 --- a/common/src/abstractions/state.service.ts +++ b/common/src/abstractions/state.service.ts @@ -242,8 +242,6 @@ export abstract class StateService { setLocalData: (value: string, options?: StorageOptions) => Promise; getLocale: (options?: StorageOptions) => Promise; setLocale: (value: string, options?: StorageOptions) => Promise; - getLoginRedirect: (options?: StorageOptions) => Promise; - setLoginRedirect: (value: any, options?: StorageOptions) => Promise; getMainWindowSize: (options?: StorageOptions) => Promise; setMainWindowSize: (value: number, options?: StorageOptions) => Promise; getMinimizeOnCopyToClipboard: (options?: StorageOptions) => Promise; diff --git a/common/src/services/state.service.ts b/common/src/services/state.service.ts index 39a08f5018..3714b3e74b 100644 --- a/common/src/services/state.service.ts +++ b/common/src/services/state.service.ts @@ -1633,19 +1633,6 @@ export class StateService< ); } - async getLoginRedirect(options?: StorageOptions): Promise { - return (await this.getGlobals(this.reconcileOptions(options, this.defaultInMemoryOptions))) - ?.loginRedirect; - } - - async setLoginRedirect(value: any, options?: StorageOptions): Promise { - const globals = await this.getGlobals( - this.reconcileOptions(options, this.defaultInMemoryOptions) - ); - globals.loginRedirect = value; - await this.saveGlobals(globals, this.reconcileOptions(options, this.defaultInMemoryOptions)); - } - async getMainWindowSize(options?: StorageOptions): Promise { return (await this.getGlobals(this.reconcileOptions(options, this.defaultInMemoryOptions))) ?.mainWindowSize;