From cf4878e08a13de270d1130c263f77a7b19b7be4d Mon Sep 17 00:00:00 2001
From: Alex ORLUC <alex.orluc@maarch.org>
Date: Wed, 26 Oct 2022 18:55:17 +0200
Subject: [PATCH] FIX #22648 TIME 0:30 fix guard with
 authenticationInformations

---
 src/frontend/app/service/auth.guard.ts | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/frontend/app/service/auth.guard.ts b/src/frontend/app/service/auth.guard.ts
index 0337577c10..44cb9171d5 100644
--- a/src/frontend/app/service/auth.guard.ts
+++ b/src/frontend/app/service/auth.guard.ts
@@ -28,21 +28,21 @@ 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.authMode = data.connection;
                         this.authService.changeKey = data.changeKey;
                         this.authService.coreUrl = data.coreUrl;
                         this.localStorage.setAppSession(data.instanceId);
+                        return true;
                     })
-                ). subscribe();
-                return true;
+                );
             }
         } else if (!this.authService.authFailed) {
             this.menu.enable(true, 'left-menu');
-- 
GitLab