Merge branch 'dmp-refactoring' of https://code-repo.d4science.org/MaDgiK-CITE/argos into dmp-refactoring

This commit is contained in:
Thomas Georgios Giannos 2024-04-04 13:54:05 +03:00
commit 6eed99c1cc
3 changed files with 9 additions and 8 deletions

View File

@ -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]));
}
});
}

View File

@ -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('/') );
}

View File

@ -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(['/']);
}
}));
}