From b8d85237a8dcff24055fb55e8ca0bb0b1e13b794 Mon Sep 17 00:00:00 2001 From: Daniel von Atzigen Date: Wed, 27 Nov 2024 17:33:05 +0100 Subject: [PATCH] Fix disclaimer not appearing in anonymous mode --- .../src/lib/features/auth/auth.service.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/libs/client-shared/src/lib/features/auth/auth.service.ts b/libs/client-shared/src/lib/features/auth/auth.service.ts index e1da50f7..df010811 100644 --- a/libs/client-shared/src/lib/features/auth/auth.service.ts +++ b/libs/client-shared/src/lib/features/auth/auth.service.ts @@ -27,7 +27,8 @@ export class AuthService { private readonly _isInitialized$ = new BehaviorSubject(false); async initialize(oAuthConfig: Record) { - if (oAuthConfig['anonymous_mode']) { + const isAnonymous = oAuthConfig['anonymous_mode']; + if (isAnonymous) { this.setState(AuthState.Success); this.store.dispatch(appSharedStateActions.setAnonymousMode()); } else { @@ -50,6 +51,14 @@ export class AuthService { this.store.dispatch(appSharedStateActions.loadUserProfile()); } this._isInitialized$.next(true); + + const isLoggedIn = isAnonymous || this._state$.value === AuthState.Success; + if (isLoggedIn && !this.configService.getHideDisclaimer()) { + this.dialogService.open(DisclaimerDialogComponent, { + width: '500px', + disableClose: true, + }); + } } async signIn(): Promise { @@ -62,13 +71,6 @@ export class AuthService { // If something else has interrupted the auth process, then we don't want to signal a success. if (this._state$.value === AuthState.Ongoing) { this._state$.next(AuthState.Success); - - if (!this.configService.getHideDisclaimer()) { - this.dialogService.open(DisclaimerDialogComponent, { - width: '500px', - disableClose: true, - }); - } } } } else {