From 203010063159c772b8f4b6767600aea0993d7f07 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 8 Feb 2018 10:48:50 -0500 Subject: [PATCH] sync after login --- src/app/accounts/login.component.ts | 5 +++-- src/app/accounts/two-factor.component.ts | 4 +++- src/app/services/services.module.ts | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/app/accounts/login.component.ts b/src/app/accounts/login.component.ts index fccf0aa58c..7be831f6e0 100644 --- a/src/app/accounts/login.component.ts +++ b/src/app/accounts/login.component.ts @@ -18,6 +18,7 @@ import { AuthResult } from 'jslib/models/domain/authResult'; import { AuthService } from 'jslib/abstractions/auth.service'; import { I18nService } from 'jslib/abstractions/i18n.service'; +import { SyncService } from 'jslib/abstractions/sync.service'; @Component({ selector: 'app-login', @@ -31,7 +32,7 @@ export class LoginComponent { formPromise: Promise; constructor(private authService: AuthService, private router: Router, private analytics: Angulartics2, - private toasterService: ToasterService, private i18nService: I18nService, + private toasterService: ToasterService, private i18nService: I18nService, private syncService: SyncService, private componentFactoryResolver: ComponentFactoryResolver) { } async submit() { @@ -58,9 +59,9 @@ export class LoginComponent { this.analytics.eventTrack.next({ action: 'Logged In To Two-step' }); this.router.navigate(['2fa']); } else { + this.syncService.fullSync(true); this.analytics.eventTrack.next({ action: 'Logged In' }); this.router.navigate(['vault']); - // TODO: sync on load to vault? } } catch { } } diff --git a/src/app/accounts/two-factor.component.ts b/src/app/accounts/two-factor.component.ts index c2ee7ba6e1..c58a208fa3 100644 --- a/src/app/accounts/two-factor.component.ts +++ b/src/app/accounts/two-factor.component.ts @@ -25,6 +25,7 @@ import { ApiService } from 'jslib/abstractions/api.service'; import { AuthService } from 'jslib/abstractions/auth.service'; import { I18nService } from 'jslib/abstractions/i18n.service'; import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; +import { SyncService } from 'jslib/abstractions/sync.service'; import { TwoFactorProviders } from 'jslib/services/auth.service'; @@ -51,7 +52,7 @@ export class TwoFactorComponent implements OnInit { constructor(private authService: AuthService, private router: Router, private analytics: Angulartics2, private toasterService: ToasterService, private i18nService: I18nService, private apiService: ApiService, private platformUtilsService: PlatformUtilsService, - private componentFactoryResolver: ComponentFactoryResolver) { + private componentFactoryResolver: ComponentFactoryResolver, private syncService: SyncService) { this.u2fSupported = this.platformUtilsService.supportsU2f(window); } @@ -126,6 +127,7 @@ export class TwoFactorComponent implements OnInit { try { this.formPromise = this.authService.logInTwoFactor(this.selectedProviderType, this.token, this.remember); await this.formPromise; + this.syncService.fullSync(true); this.analytics.eventTrack.next({ action: 'Logged In From Two-step' }); this.router.navigate(['vault']); } catch { diff --git a/src/app/services/services.module.ts b/src/app/services/services.module.ts index f2c9af9451..5a26b8a8ca 100644 --- a/src/app/services/services.module.ts +++ b/src/app/services/services.module.ts @@ -132,6 +132,7 @@ function initFactory(i18n: I18nService, platformUtils: DesktopPlatformUtilsServi { provide: PlatformUtilsServiceAbstraction, useValue: platformUtilsService }, { provide: PasswordGenerationServiceAbstraction, useValue: passwordGenerationService }, { provide: ApiServiceAbstraction, useValue: apiService }, + { provide: SyncServiceAbstraction, useValue: syncService }, { provide: APP_INITIALIZER, useFactory: initFactory,