From 05e6d2c0f0aa6cae6a5e53fac6dccf2a1d75a555 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 25 Apr 2018 12:08:18 -0400 Subject: [PATCH] move sync to post login action --- src/angular/components/login.component.ts | 7 +++++-- src/angular/components/two-factor.component.ts | 9 ++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/angular/components/login.component.ts b/src/angular/components/login.component.ts index 0da933fa28..79d5589622 100644 --- a/src/angular/components/login.component.ts +++ b/src/angular/components/login.component.ts @@ -16,13 +16,14 @@ export class LoginComponent { masterPassword: string = ''; showPassword: boolean = false; formPromise: Promise; + onSuccessfullLogin: () => Promise; protected twoFactorRoute = '2fa'; protected successRoute = 'vault'; constructor(protected authService: AuthService, protected router: Router, protected analytics: Angulartics2, protected toasterService: ToasterService, - protected i18nService: I18nService, protected syncService: SyncService) { } + protected i18nService: I18nService) { } async submit() { if (this.email == null || this.email === '') { @@ -48,7 +49,9 @@ export class LoginComponent { this.analytics.eventTrack.next({ action: 'Logged In To Two-step' }); this.router.navigate([this.twoFactorRoute]); } else { - this.syncService.fullSync(true); + if (this.onSuccessfullLogin != null) { + this.onSuccessfullLogin(); + } this.analytics.eventTrack.next({ action: 'Logged In' }); this.router.navigate([this.successRoute]); } diff --git a/src/angular/components/two-factor.component.ts b/src/angular/components/two-factor.component.ts index a448e12843..9c2e4ca354 100644 --- a/src/angular/components/two-factor.component.ts +++ b/src/angular/components/two-factor.component.ts @@ -37,6 +37,7 @@ export class TwoFactorComponent implements OnInit, OnDestroy { twoFactorEmail: string = null; formPromise: Promise; emailPromise: Promise; + onSuccessfullLogin: () => Promise; protected loginRoute = 'login'; protected successRoute = 'vault'; @@ -44,8 +45,8 @@ export class TwoFactorComponent implements OnInit, OnDestroy { constructor(protected authService: AuthService, protected router: Router, protected analytics: Angulartics2, protected toasterService: ToasterService, protected i18nService: I18nService, protected apiService: ApiService, - protected platformUtilsService: PlatformUtilsService, protected syncService: SyncService, - protected win: Window, protected environmentService: EnvironmentService) { + protected platformUtilsService: PlatformUtilsService, protected win: Window, + protected environmentService: EnvironmentService) { this.u2fSupported = this.platformUtilsService.supportsU2f(win); } @@ -164,7 +165,9 @@ export class TwoFactorComponent implements OnInit, OnDestroy { try { this.formPromise = this.authService.logInTwoFactor(this.selectedProviderType, this.token, this.remember); await this.formPromise; - this.syncService.fullSync(true); + if (this.onSuccessfullLogin != null) { + this.onSuccessfullLogin(); + } this.analytics.eventTrack.next({ action: 'Logged In From Two-step' }); this.router.navigate([this.successRoute]); } catch (e) {