X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ceph%2Fsrc%2Fpybind%2Fmgr%2Fdashboard%2Ffrontend%2Fsrc%2Fapp%2Fcore%2Fauth%2Flogin%2Flogin.component.ts;h=770a4821db177d62bf0d164126d33821916df540;hb=f6b5b4d738b87d88d2de35127b6b0e41eae2a272;hp=9286e31d30f107ea11a64662cdd9111cbacbda0b;hpb=12732ca2e80d168d344a265acffc1fbd1fa1f1b5;p=ceph.git diff --git a/ceph/src/pybind/mgr/dashboard/frontend/src/app/core/auth/login/login.component.ts b/ceph/src/pybind/mgr/dashboard/frontend/src/app/core/auth/login/login.component.ts index 9286e31d3..770a4821d 100644 --- a/ceph/src/pybind/mgr/dashboard/frontend/src/app/core/auth/login/login.component.ts +++ b/ceph/src/pybind/mgr/dashboard/frontend/src/app/core/auth/login/login.component.ts @@ -1,6 +1,7 @@ import { Component, OnInit } from '@angular/core'; -import { Router } from '@angular/router'; +import { ActivatedRoute, Router } from '@angular/router'; +import * as _ from 'lodash'; import { BsModalService } from 'ngx-bootstrap/modal'; import { AuthService } from '../../../shared/api/auth.service'; @@ -15,11 +16,13 @@ import { AuthStorageService } from '../../../shared/services/auth-storage.servic export class LoginComponent implements OnInit { model = new Credentials(); isLoginActive = false; + returnUrl: string; constructor( private authService: AuthService, private authStorageService: AuthStorageService, private bsModalService: BsModalService, + private route: ActivatedRoute, private router: Router ) {} @@ -64,7 +67,8 @@ export class LoginComponent implements OnInit { login() { this.authService.login(this.model).subscribe(() => { - this.router.navigate(['']); + const url = _.get(this.route.snapshot.queryParams, 'returnUrl', '/'); + this.router.navigate([url]); }); } }