From e063c8b09de8464f7e6e1e3ef61b8fcc338dfa87 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 2 Jul 2019 08:18:42 -0400 Subject: [PATCH] purge state on lock/logout --- jslib | 2 +- src/app/accounts/lock.component.ts | 5 +++-- src/app/accounts/login.component.ts | 5 +++-- src/app/accounts/two-factor.component.ts | 8 ++++++-- src/app/app.component.ts | 6 +++++- 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/jslib b/jslib index 00f1aad65e..2aa71f98a1 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit 00f1aad65ea2e243713d409873dfb5d833296897 +Subproject commit 2aa71f98a1f623470b3bd71306e0ef8a1ba97758 diff --git a/src/app/accounts/lock.component.ts b/src/app/accounts/lock.component.ts index 39662dfd3e..4bc028703b 100644 --- a/src/app/accounts/lock.component.ts +++ b/src/app/accounts/lock.component.ts @@ -7,6 +7,7 @@ import { I18nService } from 'jslib/abstractions/i18n.service'; import { LockService } from 'jslib/abstractions/lock.service'; import { MessagingService } from 'jslib/abstractions/messaging.service'; import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; +import { StateService } from 'jslib/abstractions/state.service'; import { StorageService } from 'jslib/abstractions/storage.service'; import { UserService } from 'jslib/abstractions/user.service'; @@ -21,8 +22,8 @@ export class LockComponent extends BaseLockComponent { platformUtilsService: PlatformUtilsService, messagingService: MessagingService, userService: UserService, cryptoService: CryptoService, storageService: StorageService, lockService: LockService, - environmentService: EnvironmentService) { + environmentService: EnvironmentService, stateService: StateService) { super(router, i18nService, platformUtilsService, messagingService, userService, cryptoService, - storageService, lockService, environmentService); + storageService, lockService, environmentService, stateService); } } diff --git a/src/app/accounts/login.component.ts b/src/app/accounts/login.component.ts index 21cc7dc163..f416d8bf21 100644 --- a/src/app/accounts/login.component.ts +++ b/src/app/accounts/login.component.ts @@ -11,6 +11,7 @@ import { EnvironmentComponent } from './environment.component'; import { AuthService } from 'jslib/abstractions/auth.service'; import { I18nService } from 'jslib/abstractions/i18n.service'; import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; +import { StateService } from 'jslib/abstractions/state.service'; import { StorageService } from 'jslib/abstractions/storage.service'; import { SyncService } from 'jslib/abstractions/sync.service'; @@ -29,8 +30,8 @@ export class LoginComponent extends BaseLoginComponent { constructor(authService: AuthService, router: Router, i18nService: I18nService, syncService: SyncService, private componentFactoryResolver: ComponentFactoryResolver, storageService: StorageService, - platformUtilsService: PlatformUtilsService) { - super(authService, router, platformUtilsService, i18nService, storageService); + platformUtilsService: PlatformUtilsService, stateService: StateService) { + super(authService, router, platformUtilsService, i18nService, storageService, stateService); super.onSuccessfulLogin = () => { return syncService.fullSync(true); }; diff --git a/src/app/accounts/two-factor.component.ts b/src/app/accounts/two-factor.component.ts index 5a0a5d0866..e2c3b22032 100644 --- a/src/app/accounts/two-factor.component.ts +++ b/src/app/accounts/two-factor.component.ts @@ -16,6 +16,8 @@ import { AuthService } from 'jslib/abstractions/auth.service'; import { EnvironmentService } from 'jslib/abstractions/environment.service'; import { I18nService } from 'jslib/abstractions/i18n.service'; import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; +import { StateService } from 'jslib/abstractions/state.service'; +import { StorageService } from 'jslib/abstractions/storage.service'; import { SyncService } from 'jslib/abstractions/sync.service'; import { ModalComponent } from 'jslib/angular/components/modal.component'; @@ -33,8 +35,10 @@ export class TwoFactorComponent extends BaseTwoFactorComponent { constructor(authService: AuthService, router: Router, i18nService: I18nService, apiService: ApiService, platformUtilsService: PlatformUtilsService, syncService: SyncService, - environmentService: EnvironmentService, private componentFactoryResolver: ComponentFactoryResolver) { - super(authService, router, i18nService, apiService, platformUtilsService, window, environmentService); + environmentService: EnvironmentService, private componentFactoryResolver: ComponentFactoryResolver, + stateService: StateService, storageService: StorageService) { + super(authService, router, i18nService, apiService, platformUtilsService, window, environmentService, + stateService, storageService); super.onSuccessfulLogin = () => { return syncService.fullSync(true); }; diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 0364e257ee..f0bb08f0c3 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -42,6 +42,7 @@ import { PasswordGenerationService } from 'jslib/abstractions/passwordGeneration import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; import { SearchService } from 'jslib/abstractions/search.service'; import { SettingsService } from 'jslib/abstractions/settings.service'; +import { StateService } from 'jslib/abstractions/state.service'; import { StorageService } from 'jslib/abstractions/storage.service'; import { SyncService } from 'jslib/abstractions/sync.service'; import { SystemService } from 'jslib/abstractions/system.service'; @@ -92,7 +93,8 @@ export class AppComponent implements OnInit { private cryptoService: CryptoService, private componentFactoryResolver: ComponentFactoryResolver, private messagingService: MessagingService, private collectionService: CollectionService, private searchService: SearchService, private notificationsService: NotificationsService, - private platformUtilsService: PlatformUtilsService, private systemService: SystemService) { } + private platformUtilsService: PlatformUtilsService, private systemService: SystemService, + private stateService: StateService) { } ngOnInit() { this.ngZone.runOutsideAngular(() => { @@ -139,6 +141,7 @@ export class AppComponent implements OnInit { if (this.modal != null) { this.modal.close(); } + this.stateService.purge(); this.router.navigate(['lock']); this.notificationsService.updateConnection(); this.updateAppMenu(); @@ -219,6 +222,7 @@ export class AppComponent implements OnInit { this.collectionService.clear(userId), this.passwordGenerationService.clear(), this.lockService.clear(), + this.stateService.purge(), ]); this.lockService.pinLocked = false;