login with the default tenant
This commit is contained in:
parent
8cec0c3552
commit
5decf6f4b1
|
@ -272,7 +272,7 @@ export class AuthService extends BaseService {
|
||||||
})
|
})
|
||||||
.catch((error) => this.onAuthenticateError(error));
|
.catch((error) => this.onAuthenticateError(error));
|
||||||
} else {
|
} else {
|
||||||
this.zone.run(() => this.router.navigate(['/login/post']));
|
this.zone.run(() => this.router.navigate([returnUrl]));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,22 +29,23 @@ export class LoginComponent extends BaseComponent implements OnInit {
|
||||||
) { super(); }
|
) { super(); }
|
||||||
|
|
||||||
ngOnInit(): void {
|
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 => {
|
this.keycloakService.isLoggedIn().then(isLoggedIn => {
|
||||||
if (!isLoggedIn) {
|
if (!isLoggedIn) {
|
||||||
this.authService.authenticate('/login/post');
|
this.authService.authenticate('/');
|
||||||
} else {
|
} else {
|
||||||
this.authService.prepareAuthRequest(from(this.keycloakService.getToken())).pipe(takeUntil(this._destroyed)).subscribe(
|
this.authService.prepareAuthRequest(from(this.keycloakService.getToken())).pipe(takeUntil(this._destroyed)).subscribe(
|
||||||
() => {
|
() => {
|
||||||
let returnUrL = this.returnUrl;
|
let returnUrL = this.returnUrl;
|
||||||
let queryParams: Params = {};
|
let queryParams: Params = {};
|
||||||
if(!this.authService.selectedTenant()){
|
if(!this.authService.selectedTenant()){
|
||||||
returnUrL = '/login/post';
|
this.authService.selectedTenant('default');
|
||||||
queryParams.returnUrl = this.returnUrl;
|
// returnUrL = '/login/post';
|
||||||
|
// queryParams.returnUrl = this.returnUrl;
|
||||||
}
|
}
|
||||||
this.zone.run(() => this.router.navigate([returnUrL],{queryParams} ));
|
this.zone.run(() => this.router.navigate([returnUrL],{queryParams} ));
|
||||||
},
|
},
|
||||||
(error) => this.authService.authenticate('/login/post') );
|
(error) => this.authService.authenticate('/') );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,8 @@ export class StatusCodeInterceptor extends BaseInterceptor {
|
||||||
}
|
}
|
||||||
const error: HttpError = this.httpErrorHandlingService.getError(err);
|
const error: HttpError = this.httpErrorHandlingService.getError(err);
|
||||||
if (error.statusCode === 403 && error.errorCode === 103) {
|
if (error.statusCode === 403 && error.errorCode === 103) {
|
||||||
this.authService.selectedTenant(null);
|
this.authService.selectedTenant('default');
|
||||||
this.router.navigate(['/login/post']);
|
this.router.navigate(['/']);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue