diff --git a/src/frontend/app/service/auth.guard.ts b/src/frontend/app/service/auth.guard.ts index cde7ffb9a6ffb343ab96aeb37387dd48e2f948fc..a34137644dada64bbc587ee0d8da19388a67117f 100644 --- a/src/frontend/app/service/auth.guard.ts +++ b/src/frontend/app/service/auth.guard.ts @@ -28,13 +28,13 @@ export class AuthGuard implements CanActivate { public dialog: MatDialog, private menu: MenuController) { } - canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> | boolean { + canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<any> | boolean { if (route.url.join('/') === 'login') { if (this.authService.isAuth()) { this.router.navigate(['/home']); return false; } else { - this.http.get('../rest/authenticationInformations').pipe( + return this.http.get('../rest/authenticationInformations').pipe( map((data: any) => { this.authService.loginMessage = data.loginMessage; this.authService.authMode = data.connection; @@ -42,9 +42,9 @@ export class AuthGuard implements CanActivate { this.authService.coreUrl = data.coreUrl; this.authService.mailServerOnline = data.mailServerOnline; this.localStorage.setAppSession(data.instanceId); + return true; }) - ). subscribe(); - return true; + ); } } else if (!this.authService.authFailed) { this.menu.enable(true, 'left-menu');