X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ceph%2Fsrc%2Fpybind%2Fmgr%2Fdashboard%2Ffrontend%2Fsrc%2Fapp%2Fshared%2Fservices%2Fauth-guard.service.ts;h=61c06c81d2bcd9fc8b383a2adfecf835fd6fa656;hb=f6b5b4d738b87d88d2de35127b6b0e41eae2a272;hp=7e11d9a2d033804488e687e5504b884ede4bfb0d;hpb=12732ca2e80d168d344a265acffc1fbd1fa1f1b5;p=ceph.git diff --git a/ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/services/auth-guard.service.ts b/ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/services/auth-guard.service.ts index 7e11d9a2d..61c06c81d 100644 --- a/ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/services/auth-guard.service.ts +++ b/ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/services/auth-guard.service.ts @@ -1,5 +1,11 @@ import { Injectable } from '@angular/core'; -import { CanActivate, CanActivateChild, Router } from '@angular/router'; +import { + ActivatedRouteSnapshot, + CanActivate, + CanActivateChild, + Router, + RouterStateSnapshot +} from '@angular/router'; import { AuthStorageService } from './auth-storage.service'; @@ -9,15 +15,15 @@ import { AuthStorageService } from './auth-storage.service'; export class AuthGuardService implements CanActivate, CanActivateChild { constructor(private router: Router, private authStorageService: AuthStorageService) {} - canActivate() { + canActivate(_route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { if (this.authStorageService.isLoggedIn()) { return true; } - this.router.navigate(['/login']); + this.router.navigate(['/login'], { queryParams: { returnUrl: state.url } }); return false; } - canActivateChild(): boolean { - return this.canActivate(); + canActivateChild(childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean { + return this.canActivate(childRoute, state); } }