mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 16:23:44 +00:00
sync after login
This commit is contained in:
@@ -18,6 +18,7 @@ import { AuthResult } from 'jslib/models/domain/authResult';
|
|||||||
|
|
||||||
import { AuthService } from 'jslib/abstractions/auth.service';
|
import { AuthService } from 'jslib/abstractions/auth.service';
|
||||||
import { I18nService } from 'jslib/abstractions/i18n.service';
|
import { I18nService } from 'jslib/abstractions/i18n.service';
|
||||||
|
import { SyncService } from 'jslib/abstractions/sync.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-login',
|
selector: 'app-login',
|
||||||
@@ -31,7 +32,7 @@ export class LoginComponent {
|
|||||||
formPromise: Promise<AuthResult>;
|
formPromise: Promise<AuthResult>;
|
||||||
|
|
||||||
constructor(private authService: AuthService, private router: Router, private analytics: Angulartics2,
|
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) { }
|
private componentFactoryResolver: ComponentFactoryResolver) { }
|
||||||
|
|
||||||
async submit() {
|
async submit() {
|
||||||
@@ -58,9 +59,9 @@ export class LoginComponent {
|
|||||||
this.analytics.eventTrack.next({ action: 'Logged In To Two-step' });
|
this.analytics.eventTrack.next({ action: 'Logged In To Two-step' });
|
||||||
this.router.navigate(['2fa']);
|
this.router.navigate(['2fa']);
|
||||||
} else {
|
} else {
|
||||||
|
this.syncService.fullSync(true);
|
||||||
this.analytics.eventTrack.next({ action: 'Logged In' });
|
this.analytics.eventTrack.next({ action: 'Logged In' });
|
||||||
this.router.navigate(['vault']);
|
this.router.navigate(['vault']);
|
||||||
// TODO: sync on load to vault?
|
|
||||||
}
|
}
|
||||||
} catch { }
|
} catch { }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import { ApiService } from 'jslib/abstractions/api.service';
|
|||||||
import { AuthService } from 'jslib/abstractions/auth.service';
|
import { AuthService } from 'jslib/abstractions/auth.service';
|
||||||
import { I18nService } from 'jslib/abstractions/i18n.service';
|
import { I18nService } from 'jslib/abstractions/i18n.service';
|
||||||
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
||||||
|
import { SyncService } from 'jslib/abstractions/sync.service';
|
||||||
|
|
||||||
import { TwoFactorProviders } from 'jslib/services/auth.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,
|
constructor(private authService: AuthService, private router: Router, private analytics: Angulartics2,
|
||||||
private toasterService: ToasterService, private i18nService: I18nService, private apiService: ApiService,
|
private toasterService: ToasterService, private i18nService: I18nService, private apiService: ApiService,
|
||||||
private platformUtilsService: PlatformUtilsService,
|
private platformUtilsService: PlatformUtilsService,
|
||||||
private componentFactoryResolver: ComponentFactoryResolver) {
|
private componentFactoryResolver: ComponentFactoryResolver, private syncService: SyncService) {
|
||||||
this.u2fSupported = this.platformUtilsService.supportsU2f(window);
|
this.u2fSupported = this.platformUtilsService.supportsU2f(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,6 +127,7 @@ export class TwoFactorComponent implements OnInit {
|
|||||||
try {
|
try {
|
||||||
this.formPromise = this.authService.logInTwoFactor(this.selectedProviderType, this.token, this.remember);
|
this.formPromise = this.authService.logInTwoFactor(this.selectedProviderType, this.token, this.remember);
|
||||||
await this.formPromise;
|
await this.formPromise;
|
||||||
|
this.syncService.fullSync(true);
|
||||||
this.analytics.eventTrack.next({ action: 'Logged In From Two-step' });
|
this.analytics.eventTrack.next({ action: 'Logged In From Two-step' });
|
||||||
this.router.navigate(['vault']);
|
this.router.navigate(['vault']);
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ function initFactory(i18n: I18nService, platformUtils: DesktopPlatformUtilsServi
|
|||||||
{ provide: PlatformUtilsServiceAbstraction, useValue: platformUtilsService },
|
{ provide: PlatformUtilsServiceAbstraction, useValue: platformUtilsService },
|
||||||
{ provide: PasswordGenerationServiceAbstraction, useValue: passwordGenerationService },
|
{ provide: PasswordGenerationServiceAbstraction, useValue: passwordGenerationService },
|
||||||
{ provide: ApiServiceAbstraction, useValue: apiService },
|
{ provide: ApiServiceAbstraction, useValue: apiService },
|
||||||
|
{ provide: SyncServiceAbstraction, useValue: syncService },
|
||||||
{
|
{
|
||||||
provide: APP_INITIALIZER,
|
provide: APP_INITIALIZER,
|
||||||
useFactory: initFactory,
|
useFactory: initFactory,
|
||||||
|
|||||||
Reference in New Issue
Block a user