Skip to content

Commit

Permalink
Ensure are you still there dialog is closed before showing logging …
Browse files Browse the repository at this point in the history
…out page (#4730)

* Ensure `are you still there` dialog is closed before showing logging out page

* Fix unit test

* Fix exception thrown in setup flow

* Fix issue where `are you still there` window showed on logging out page
- if log out in logging out page fails ensure we don't kick off/continue with log out warning
  • Loading branch information
richard-cox authored Nov 3, 2020
1 parent 8ed7bbe commit cd89026
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('LogOutDialogComponent', () => {
expect(component).toBeTruthy();
});

it('should naivgate after countdown', fakeAsync(() => {
it('should navigate after countdown', fakeAsync(() => {
const spy = spyOn(router, 'navigate');

component.data = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export class LogOutDialogComponent implements OnInit, OnDestroy {
if (this.countDown <= 0) {
this.autoLogout.unsubscribe();
this.router.navigate(['/login/logout']);
this.dialogRef.close(false);
} else {
this.percentage = ((this.countdownTotal - this.countDown) / this.countdownTotal) * 100;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Store } from '@ngrx/store';
import { Observable, of } from 'rxjs';
import { switchMap } from 'rxjs/operators';
import { filter, switchMap } from 'rxjs/operators';

import { GeneralEntityAppState } from '../../../../store/src/app-state';
import { selectSessionData } from '../../../../store/src/reducers/auth.reducer';
Expand Down Expand Up @@ -61,7 +61,7 @@ export const stratosPermissionConfigs: IPermissionConfigs = {
};

export class StratosUserPermissionsChecker extends BaseCurrentUserPermissionsChecker implements ICurrentUserPermissionsChecker {
constructor(private store: Store<GeneralEntityAppState>, ) {
constructor(private store: Store<GeneralEntityAppState>,) {
super();
}

Expand Down Expand Up @@ -114,6 +114,7 @@ export class StratosUserPermissionsChecker extends BaseCurrentUserPermissionsChe

private apiKeyCheck(): Observable<boolean> {
return this.store.select(selectSessionData()).pipe(
filter(sessionData => !!sessionData),
switchMap(sessionData => {
switch (sessionData.config.APIKeysEnabled) {
case APIKeysEnabled.ADMIN_ONLY:
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/packages/core/src/logged-in.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class LoggedInService {

this.sub = this.store.select(s => s.auth)
.subscribe((auth: AuthState) => {
if (auth.loggedIn && auth.sessionData && auth.sessionData.valid) {
if (auth.loggedIn && auth.sessionData && auth.sessionData.valid && !auth.error) {
if (!this.sessionChecker || this.sessionChecker.closed) {
this.openSessionCheckerPoll();
}
Expand Down

0 comments on commit cd89026

Please sign in to comment.