diff --git a/lib/core/services/auth-guard-ecm.service.ts b/lib/core/services/auth-guard-ecm.service.ts index fbd3162630..fcc74d6546 100644 --- a/lib/core/services/auth-guard-ecm.service.ts +++ b/lib/core/services/auth-guard-ecm.service.ts @@ -24,6 +24,7 @@ import { AppConfigService } from '../app-config/app-config.service'; import { AuthGuardBase } from './auth-guard-base'; import { Observable } from 'rxjs'; import { MatDialog } from '@angular/material/dialog'; +import { StorageService } from './storage.service'; @Injectable({ providedIn: 'root' @@ -33,12 +34,18 @@ export class AuthGuardEcm extends AuthGuardBase { constructor(authenticationService: AuthenticationService, router: Router, appConfigService: AppConfigService, - dialog: MatDialog) { + dialog: MatDialog, + private storageService: StorageService) { super(authenticationService, router, appConfigService, dialog); } checkLogin(_: ActivatedRouteSnapshot, redirectUrl: string): Observable | Promise | boolean { + const redirectFragment = this.storageService.getItem('loginFragment'); if (this.authenticationService.isEcmLoggedIn() || this.withCredentials) { + if (redirectFragment) { + this.router.navigateByUrl(redirectFragment); + this.storageService.removeItem('loginFragment'); + } return true; } this.redirectToUrl('ECM', redirectUrl);