1
0
mirror of https://github.com/bitwarden/desktop.git synced 2024-12-28 17:18:24 +01:00

sync after login

This commit is contained in:
Kyle Spearrin 2018-02-08 10:48:50 -05:00
parent 58e39c0c81
commit 2030100631
3 changed files with 7 additions and 3 deletions

View File

@ -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<AuthResult>;
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 { }
}

View File

@ -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 {

View File

@ -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,