diff --git a/dmp-frontend/src/app/core/services/auth/auth.service.ts b/dmp-frontend/src/app/core/services/auth/auth.service.ts index 38531c729..762aff749 100644 --- a/dmp-frontend/src/app/core/services/auth/auth.service.ts +++ b/dmp-frontend/src/app/core/services/auth/auth.service.ts @@ -272,7 +272,7 @@ export class AuthService extends BaseService { }) .catch((error) => this.onAuthenticateError(error)); } else { - this.zone.run(() => this.router.navigate(['/login/post'])); + this.zone.run(() => this.router.navigate([returnUrl])); } }); } diff --git a/dmp-frontend/src/app/ui/auth/login/login.component.ts b/dmp-frontend/src/app/ui/auth/login/login.component.ts index d87d863fb..bd00ef0d2 100644 --- a/dmp-frontend/src/app/ui/auth/login/login.component.ts +++ b/dmp-frontend/src/app/ui/auth/login/login.component.ts @@ -29,22 +29,23 @@ export class LoginComponent extends BaseComponent implements OnInit { ) { super(); } ngOnInit(): void { - this.returnUrl = this.route.snapshot.queryParamMap.get('returnUrl') || '/login/post'; + this.returnUrl = this.route.snapshot.queryParamMap.get('returnUrl') || '/'; this.keycloakService.isLoggedIn().then(isLoggedIn => { if (!isLoggedIn) { - this.authService.authenticate('/login/post'); + this.authService.authenticate('/'); } else { this.authService.prepareAuthRequest(from(this.keycloakService.getToken())).pipe(takeUntil(this._destroyed)).subscribe( () => { let returnUrL = this.returnUrl; let queryParams: Params = {}; if(!this.authService.selectedTenant()){ - returnUrL = '/login/post'; - queryParams.returnUrl = this.returnUrl; + this.authService.selectedTenant('default'); + // returnUrL = '/login/post'; + // queryParams.returnUrl = this.returnUrl; } this.zone.run(() => this.router.navigate([returnUrL],{queryParams} )); }, - (error) => this.authService.authenticate('/login/post') ); + (error) => this.authService.authenticate('/') ); } diff --git a/dmp-frontend/src/common/http/interceptors/status-code.interceptor.ts b/dmp-frontend/src/common/http/interceptors/status-code.interceptor.ts index d83bb4a4f..809659444 100644 --- a/dmp-frontend/src/common/http/interceptors/status-code.interceptor.ts +++ b/dmp-frontend/src/common/http/interceptors/status-code.interceptor.ts @@ -21,8 +21,8 @@ export class StatusCodeInterceptor extends BaseInterceptor { } const error: HttpError = this.httpErrorHandlingService.getError(err); if (error.statusCode === 403 && error.errorCode === 103) { - this.authService.selectedTenant(null); - this.router.navigate(['/login/post']); + this.authService.selectedTenant('default'); + this.router.navigate(['/']); } })); }