-
-
-
-
-
-
-
+
+
+
+
+
network_intelligence
+
KJO Mind Care
+
+ Bienestar mental está a su alcance.
+
+
+ @if (keycloakService.isLoading()) {
+
+ } @else {
+
+
+ }
-} @else {
- @if (keycloakService.isAuthenticated()) {
-
- } @else {
-
-
-
-
KJO Mind Care
-
Welcome to the dashboard of the KJO Mind Care application.
-
-
-
-
-
-
- }
}
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index 2b4deab..ef0d738 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -2,10 +2,11 @@ import { Component, inject } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { KeycloakService } from './modules/auth/services/keycloak.service';
import { ToastComponent } from './shared/components/layout/toast/toast.component';
+import { ThemeControllerComponent } from './shared/components/layout/theme-controller/theme-controller.component';
@Component({
selector: 'app-root',
- imports: [RouterOutlet, ToastComponent],
+ imports: [RouterOutlet, ToastComponent, ThemeControllerComponent],
templateUrl: './app.component.html',
styleUrl: './app.component.css'
})
@@ -16,6 +17,10 @@ export class AppComponent {
this.keycloakService.login();
}
+ register() {
+ this.keycloakService.register();
+ }
+
ngOnInit() {
this.keycloakService.init();
}
diff --git a/src/app/modules/auth/services/keycloak.service.ts b/src/app/modules/auth/services/keycloak.service.ts
index 7dc014b..a829e4f 100644
--- a/src/app/modules/auth/services/keycloak.service.ts
+++ b/src/app/modules/auth/services/keycloak.service.ts
@@ -39,10 +39,14 @@ export class KeycloakService {
const keycloak = this.initKeycloak();
try {
+ // Solo inicializa si el usuario está autenticado
const authenticated = await keycloak.init({
- onLoad: 'login-required',
+ onLoad: 'check-sso',
+ checkLoginIframe: true,
+ checkLoginIframeInterval: 240 // segundos para refrescar la sesión
});
+
this._isLoading.set(false)
this._isAuthenticated.set(authenticated);
@@ -67,6 +71,10 @@ export class KeycloakService {
return this.keycloak.login();
}
+ register() {
+ return this.keycloak.register();
+ }
+
logout() {
this._isAuthenticated.set(false);
this._userProfile.set(undefined);
diff --git a/src/index.html b/src/index.html
index ee60f5c..9bbdc49 100644
--- a/src/index.html
+++ b/src/index.html
@@ -23,17 +23,17 @@
+
+
+
-
-
+
+